java - Dom4j selectNodes with filter in XPATH -


<results>      <details>       <number> 01 </number>     <seq> 01 </seq>   <details>    <details>       <number> 02 </number>     <seq> 01 </seq>   <details>    <details>       <number> 01 </number>     <seq> 03 </seq>   <details>   </results>   

i :

 .selectnodes("//results/details/number = '1'");   

to select number nodes = 1, returns "true" ! instead of list of nodes.
how nodes number = 1 ?

your expression "//results/details/number = '1'" selects //results/details/number , returns if 1 of these nodes - when converted string - equals '1'.
(and given xml document should return false not true).

to select number nodes text content equals 1 use expression:

//results/details/number[. = 1] 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -