Expand my Community achievements bar.

applyXPath question

Avatar

Level 6
Hi,



I´m using XMLData.parse to put a xml in memory. Then I get some nodes of that XML.



var xmldata = XMLData.parse(xfa.resolveNode("page2.xmldataset").rawValue, false);



var nodeList = XMLData.applyXPath(xmldata, "//ItemSet");



Now, for each node in the nodelist I would like to get all its child nodes.

However, it seems I can´t so something like this " nodeList.item(0).item(0)):



for (i = 1; i < nodeList.length; i++)

{

//Get the child nodes to creat a new for cycle?

}



Thank you
3 Replies

Avatar

Former Community Member
Ugh, my XPath is rusty :P



Is ItemSet the top level node of your XML in xmldata?



P.S. Don't try to post the XML here, the forum software doesn't handle XML in posts properly :(



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Never mind, it doesn't matter if ItemSet is the top level node (like I said, my XPath is rusty).



Are you trying to get a list of all the nodes under ItemSet? If so I think you need to do:



var nodeList = XMLData.applyXPath(xmldata, "//ItemSet").nodes;



Chris

Adobe Enterprise Developer Support