I am trying to use the XPATH expression "//" to find all matches of an element name no matter where they exist in the XML document. For example ..
count(//process_data/xml_data//User)
it correctly returns a value of 5 on my test XML document. Great. How would I go about grabbing the 3rd match or perhaps iterating through all matches?
I have tried the following
//process_data/xml_data//User[1]
this works. However, the following doesn't work
//process_data/xml_data//User[2]
It says the XML variable I assign the expression to is <empty>
I even tried to get it to work with a list variable (xml subtype) and assign //process_data/xml_data//User to the variable. That doesn't work, it shows <list><null/></list> as the result.
I created an xml variable and assign //process_data/xml_data//User to the variable. That doesn't work, it only shows the 1st match.
Any ideas?
One of the LC Knowledge bases specificaly says this.
/process_data/formVariable/object/data/xdp/datasets/data//TextField1
returns "Hello world 1..."
, "Hello world 2..."
, and "Hello world 3..."
and therefore is more flexible if the exact structure of an XML is not known (for example, when using a relative path).