xml - How to get a specific node value with xpath when id is in element instead of attribute? -


with xpath /levels/level[@id="3"]/value can value of level id=3 this:

<levels>      <level id="2">           <value>25</value>      </level>      <level id="3">           <value>33</value>      </level>      <level id="4">           <value>44</value>      </level> </levels> 

but xml reading formatted without attributes this:

<levels>      <level>           <id>2</id>           <value>25</value>      </level>      <level>           <id>3</id>           <value>33</value>      </level>      <level>           <id>4</id>           <value>44</value>      </level> </levels> 

what equivalent xpath second xml block value of level id=3? (it not guaranteed id=3 second node.)

how following:

/levels/level[id/text() = "3"]/value 

or

/levels/level[id/. = "3"]/value 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -