Anybody have a idea to get the xml element page wise
var _root = app.activeDocument.xmlElements.firstItem();
var xe = app.activeDocument.xmlElements.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
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.