src/main/java/de/alpharogroup/xml/xpath/XPathExtensions.java
public static NodeList getNodeList(final String xml, final String xpathExpression)
		throws XPathExpressionException, ParserConfigurationException, SAXException, IOException
	{
		final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
		domFactory.setNamespaceAware(true);
		final DocumentBuilder builder = domFactory.newDocumentBuilder();
		final Document doc = builder.parse(xml);
		final XPath xpath = XPathFactory.newInstance().newXPath();
		final XPathExpression expr = xpath.compile(xpathExpression);

		final Object result = expr.evaluate(doc, XPathConstants.NODESET);
		final NodeList nodes = (NodeList)result;
		return nodes;
	}
public static NodeList getNodeList(final String xml, final String xpathExpression)
		throws XPathExpressionException, ParserConfigurationException, SAXException, IOException
	{
		final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
		domFactory.setNamespaceAware(true);
		final DocumentBuilder builder = domFactory.newDocumentBuilder();
		final Document doc = builder.parse(xml);
		final XPath xpath = XPathFactory.newInstance().newXPath();
		final XPathExpression expr = xpath.compile(xpathExpression);

		final Object result = expr.evaluate(doc, XPathConstants.NODESET);
		final NodeList nodes = (NodeList)result;
		return nodes;
	}
Gets the node list from the given xml file and the given xpath expression.

@param xml
the xml file as string.
@param xpathExpression
the xpath expression as string.
@return the node list
@throws XPathExpressionException
the x path expression exception
@throws ParserConfigurationException
the parser configuration exception
@throws SAXException
the sAX exception
@throws IOException
Signals that an I/O exception has occurred.