xml - (//.) Expression in XPath -
i have little problem in getting xpath expression result !
let's have little xml file :
<bookstore> <book> <title lang="en">learning java</title> <price>29.99</price> </book> <book> <title lang="en">learning xpath</title> <price>39.95</price> </book> </bookstore>
what result of :
//book[//.='lear']
thank
what result of :
//book[//.='lear']
you can dump xml sample , xpath expression in xpath tester , see result (f.e using http://www.freeformatter.com/xpath-tester.html, or whatever like). above xpath , xml sample, result nothing. given particular xml input, above xpath expression same //book[false()]
. predicate (content of []
) evaluate false
because there no element containing exact string "lear"
.
"but can tell me what's useful dot after double slash symbol ?"
to answer comment, see following break-down :
//
: abbreviated syntaxdescendant-or-self
axis..
: reference current context node.//.
: can read find node anywhere in xml document. can expressed//self::node()
. note//
starts searching root element, doesn't care currentbook
element being context.
Comments
Post a Comment