aquasw
asked on
XPath first node
I'm using xpath to analyze xml file.
this is my xml:
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
I use the following xpath:
string(/bookstore/book/tit le[@lang=" eng"])
it fails becouse I have more then one node of that type. How do I ask for the first node?
Thanks.
this is my xml:
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
I use the following xpath:
string(/bookstore/book/tit
it fails becouse I have more then one node of that type. How do I ask for the first node?
Thanks.
ASKER
I used this option, but get the error message "Too many items - string"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> string(/bookstore/book/tit
use
string(/bookstore/book/tit
Cheers!