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: 

Xpath retrieve parent attribute

Solved!
Go to solution

Given this XML structure.

 

<root>
<C cmd="a">
<T>text 1</T>
</C>
<C cmd="b">
<T>text 2</T>
</C>
<C cmd="c">
<T>text 3</T>
</root>

How would I write an xpath statement to return the <C> cmd attribute for a single found <T> element? 

For example if text 2 is found then return "b"... if text 1 is found then return "a".. you get the idea.. I need the parent attribute of a found child element.

TIA

 

0 Kudos
Message 1 of 2
(3,150 Views)
Solution
Accepted by topic author FunkyMonk

Hello FunkyMonk,

 

This website talks about how to select the parent of an element in an XML expression:

http://www.tizag.com/xmlTutorial/xpathparent.php

 

Does that answer your question?

Colden
0 Kudos
Message 2 of 2
(3,138 Views)