1 Reply Latest reply on May 21, 2014 1:55 PM by schiuma24

    XML tag name array

    schiuma24 Level 1

      hi, i want to get an array of tag names

       

      lets say i have this xml

       

      <root>

      <bookmeta>

       

      bunch of xml tags i want to get the name of inside an array

       

       

       

      </boometa>

      </root>

       

      with this i get an array of xml tag objects

       

      var myDoc = app.activeDocument;

      var xml = myDoc.xmlElements[0];

      var myNodes = xml.evaluateXPathExpression('//bookmeta/child::node()');

      alert(myNodes);

         

       

      if i do .markupTag.name returns undefined,.. Help please!

        • 1. Re: XML tag name array
          schiuma24 Level 1

          done, i created this function and works fine

           

          function toArray(objects){

                                                      var i = objects.length; var array = [];

                                                      while(i--){

                                                              array.push(objects[i].markupTag.name);

                                                      }

                                                      return array;

                                                  }