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
Post a Comment