|
Hi Dave
The XPath expression /slideshow/@title will
return an Attribute object. Using the [] notation evaluates a predicate on the
current node. So if you wanted to find the 'title' attributes for all the
slideshow's that have a colour="blue" attribute you could use
/slideshow[@colour='blue']/@title
If all you want is the value of the title attribute
then
String value = doc.valueOf(
"/slideshow/@title" );
should do fine.
If you need some help understanding XPath the links
on the http://dom4j.org site might help -
Check out the 'Useful links' section with Elliotte's article and the Zvon
tutorial - both are excellent introductions to XPath.
James
|
- [dom4j-user] xpath selectSingleNode to get an attribute David Thielen
- Re: [dom4j-user] xpath selectSingleNode to get an attr... Igor Fedulov
- Re: [dom4j-user] xpath selectSingleNode to get an attr... Silvain Piree
- Re: [dom4j-user] xpath selectSingleNode to get an attr... James Strachan
- Re: [dom4j-user] xpath selectSingleNode to get an ... Markus Spath
- Re: [dom4j-user] xpath selectSingleNode to get... James Strachan
