ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Xml Attributes

Solved!
Go to solution

Hello,

 

I would like to know how to extract xml node attributes without knowing the names of those attributes. Is it possible using the XML parser of labvew 2010? 

 

For example say I am reading in the below xml structure:

 

<node_1>

 <node_2 name = second_node> text </node_2>

 <node_3 type = a> 

<node_4> text </node_4>

 </node_3>

</node_1>

 

The programmer has no knowledge of the xml structure or content when writing. How do I extract the attributes of each node?

i.e. giving the results: { {name, second_node}, {type, a"} } .

 

Thank you,

labjunky

0 Kudos
Message 1 of 3
(4,338 Views)
Solution
Accepted by topic author labJunky

Assuming you are actually going to provide well-formed XML with quotes around the attribute values, XPath is your friend.

 

XML Attributes.png

Message 2 of 3
(4,328 Views)

Darin, thanks a lot!

XPath is great. 

Do you know a good reference for more such tips and tricks?

 

thanks again,

labJunky

0 Kudos
Message 3 of 3
(4,311 Views)