DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Java DOM: Sample XPath Query
try
{
XPath xpath = XPathFactory.newInstance().newXPath();
Element e = (Element) xpath.evaluate("/Archive/Section/Description", parentNode,
XPathConstants.NODE);
printXmlNode(e);
}
catch (XPathExpressionException e)
{
e.printStackTrace();
}






Comments
Snippets Manager replied on Sun, 2008/08/24 - 2:30am
import javax.xml.xpath.*;Sharad Sharma replied on Tue, 2007/10/23 - 12:09am