xml - Correct XPath Syntax for this query -


suppose have following xml:

<tree>     <level>         <identity>              <name>firstlevel</name>         </identity>         <level2>              <data>data1</data>         </level2>     </level>     <level>         <identity>              <name>secondlevel</name>         </identity>         <level2>              <data>data2</data>         </level2>     </level>     <level>         <identity>              <name>thirdlevel</name>         </identity>         <level2>              <data>data3</data>         </level2>     </level> </tree> 

in other words, each level node has identity node name it.

and want data secondlevel > level2 > data node.

now, know can level2 > data nodes xpath along lines of:

tree/level/level2/data 

but only data secondlevel node, how syntax change? i'm trying this:

tree/level[/identity/name='secondlevel']/level2/data 

but that's not working... how write xpath , preferably efficiently possible?

thanks!!!

got it!!!

for else facing kind of issue, correct syntax close on thought... was:

tree/level[identity/name='secondlevel']/level2/data 

... remove / inner specification.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -