use of org.jaxen.dom.DOMXPath in project tutorials by eugenp.
the class JaxenDemo method getAllTutorial.
public List getAllTutorial() {
try {
FileInputStream fileIS = new FileInputStream(this.getFile());
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = builderFactory.newDocumentBuilder();
Document xmlDocument = builder.parse(fileIS);
String expression = "/tutorials/tutorial";
XPath path = new DOMXPath(expression);
List result = path.selectNodes(xmlDocument);
return result;
} catch (SAXException | IOException | ParserConfigurationException | JaxenException e) {
e.printStackTrace();
return null;
}
}
Aggregations