DOMUtils { public static Optional<NodeList> getNodeList(Document xmlDocument, String xPathExpr, String... arguments) { xPathExpr = setXpathArguments(xPathExpr, arguments); final XPath xpath = xpath(); NodeList nodeList = null; try { nodeList = (NodeList) xpath.evaluate(xPathExpr, xmlDocument, XPathConstants.NODESET); if (nodeList != null && nodeList.getLength() == 0) { nodeList = null; } return Optional.ofNullable(nodeList); } catch (final XPathExpressionException e) { throw new DOMUtilsException(e); } }  static Document bytesToDocument(byte[] bytes); static byte[] documentToBytes(Document xmlDocument); static String documentToXml(Document xmlDocument); static Optional<Node> getNode(Document xmlDocument,
			String xPathExpr, String... arguments); static Optional<NodeList> getNodeList(Document xmlDocument,
			String xPathExpr, String... arguments); static Document xmlToDocument(String xmlString); static final String DEFAULT_ENCODING; }
@Test public void testGetNodeList() { final int size1 = 8; final int size2 = 2; final NodeList nodeList = DOMUtils.getNodeList(DOCUMENT1, " final NodeList nodeList2 = DOMUtils.getNodeList(DOCUMENT2, " assertEquals(size1, nodeList.getLength()); assertEquals(size2, nodeList2.getLength()); }