I have an XML document of the type
<exp>
<header>
<expID description="experiment type">0001</expID>
<expTime unit="minutes">10000</expTime>
</header>
</exp>
I would like to extract the description attribute from Labview. I (in form of Labview) know the name of the attribute as well as in which node it is. However, I am having difficulties of getting the node attributes, in this case of<expID>
. I read that it should be possible using the invoke node for Element
but I cannot find a way to convert the node into an element.
I found this information but it only seems to work using //@*
, not for a specific node or specific attribute. Is there a simple way to get a specific attribute from a node?
What you want is to have the attribute identifier (@) as part of the XPath expression:
/exp/header/expID/@description
and then the attribute will be returned as a node reference (or an array of node references, in your case) and you can use the Get Node Text Content VI to get the data.
In general, when dealing with XML, you'll want to look up XPath syntax.