Document document = builder.parse(
then use XPath by creating an xpath object using XPathFactory.
Reading names of all customers
String expression = "/Customers/Customer/firstname";
NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET);
do we need document object to use xpath?
Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention. Check out this how-to article for more information.