11-02-2012 09:06 PM
I'm trying to use the XML parser inside LabVIEW to read a custom XML file. Basically I have several SubTest tags, each of which may or may not contain several tags. I want to search within each of these SubTest tags to see if it contains each of the tags I'm interested in and write it to a cluster if it exists or write a default value if it doesn't exist.
I'm trying to use Get All Matched Nodes and Get First Matched Node to accomplish this but it doesn't seem to work.
I use Get All Matched Nodes to search for SubTest tags and then pass each of these nodes into Get First Matched Node to search within the node for each of the several tags I'm interested in.
The problem is that Get First Matched Node returns the first match for the entire document each time, NOT the node I pass into it.
I've attached a simplified VI that illustrates the problem. Is the documentation for Get First Matched Node wrong or am I doing something wrong? Thanks.
Note: XML Help is saved in 2012 and XML Help_11 is saved for 2011
Solved! Go to Solution.
11-03-2012 05:57 AM
Your search for price is wrong.
As you already are given a link to the book node, then you don't need to search again from the top node.
Change your XPath 2 from "/bookstore/book/price" to only "price".
11-03-2012 07:18 PM
Thank you. Funny thing is I had tried "/price" and "/book/price" but never thought to just try "price". Thanks for the reply.