[Yanel-dev] XMLHelper.valueOf(Document doc, String xpath)

Michael Wechner michael.wechner at wyona.com
Thu Feb 25 15:56:36 CET 2010


Hi

I have added a utility method to the commons library

XMLHelper.valueOf(Document doc, String xpath)

Sending        src/java/org/wyona/commons/xml/XMLHelper.java
Transmitting file data .
Committed revision 47765

which allows to retrieve node values using XPath more easily, e.g.

String emailAddress = XMLHelper.valueOf(doc, 
"/organization/people/person[@name='michi']/*[local-name()='email']/@from")[0];

(whereas the above example is using local-name() which allows ignoring a 
possible namespace)

Cheers

Michi


More information about the Yanel-development mailing list