2 Replies Latest reply on Mar 16, 2015 6:01 AM by Loic.Aigon

    get the xml element pagewise

    Level 1

      How to get the XML element page wise. I need find the element in every page by order 1, 2 ,3

      Please advice.

        • 1. Re: get the xml element pagewise
          Level 1

          Anybody have a idea to get the xml element page wise


          var _root = app.activeDocument.xmlElements.firstItem();

          var xe = app.activeDocument.xmlElements[0].evaluateXPathExpression("//TABLE-REF");  

          for(i=0; i<xe.length; i++) 






          When i run the above code it find the last occurrence of the xml element. I need to get the xml element by order

          • 2. Re: get the xml element pagewise
            Loic.Aigon Adobe Community Professional



            As XMLElements can be reordered "independantly" from the layout structure, their locations in the xml structure might not reveal their contents location within the pages. I.e. one pageItem XMLElement can be found at the very top level of the root while the page item is indeed in last page.


            If you want to consider xmlElements regarding to their page location, I guess you need to look at the page 's pageitems rather and look for their associatedXMLElement, then reconstruct your array. Good thing is that it tends to be quicker this way especially if you have a large xml structure.