@Test public void testGetNode() { final Node node = DOMUtils.getNode(DOCUMENT1, XACMLXPath.XPATH_POLICY_ID).get(); final Node node2 = DOMUtils.getNode(DOCUMENT2, XACMLXPath.XPATH_POLICY_ID).get(); assertNotNull(node); assertNotNull(node2); assertEquals(POLICY_ID1, node.getNodeValue()); assertEquals(POLICY_ID2, node2.getNodeValue()); }
public static Optional<Node> getNode(Document xmlDocument, String xPathExpr, String... arguments) { xPathExpr = setXpathArguments(xPathExpr, arguments); final XPath xpath = xpath(); Node node = null; try { node = (Node) xpath.evaluate(xPathExpr, xmlDocument, XPathConstants.NODE); return Optional.ofNullable(node); } catch (final XPathExpressionException e) { throw new DOMUtilsException(e); } }
DOMUtils { public static Optional<Node> getNode(Document xmlDocument, String xPathExpr, String... arguments) { xPathExpr = setXpathArguments(xPathExpr, arguments); final XPath xpath = xpath(); Node node = null; try { node = (Node) xpath.evaluate(xPathExpr, xmlDocument, XPathConstants.NODE); return Optional.ofNullable(node); } catch (final XPathExpressionException e) { throw new DOMUtilsException(e); } } }
DOMUtils { public static Optional<Node> getNode(Document xmlDocument, String xPathExpr, String... arguments) { xPathExpr = setXpathArguments(xPathExpr, arguments); final XPath xpath = xpath(); Node node = null; try { node = (Node) xpath.evaluate(xPathExpr, xmlDocument, XPathConstants.NODE); return Optional.ofNullable(node); } catch (final XPathExpressionException e) { throw new DOMUtilsException(e); } }  }
DOMUtils { public static Optional<Node> getNode(Document xmlDocument, String xPathExpr, String... arguments) { xPathExpr = setXpathArguments(xPathExpr, arguments); final XPath xpath = xpath(); Node node = null; try { node = (Node) xpath.evaluate(xPathExpr, xmlDocument, XPathConstants.NODE); return Optional.ofNullable(node); } 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); }
DOMUtils { public static Optional<Node> getNode(Document xmlDocument, String xPathExpr, String... arguments) { xPathExpr = setXpathArguments(xPathExpr, arguments); final XPath xpath = xpath(); Node node = null; try { node = (Node) xpath.evaluate(xPathExpr, xmlDocument, XPathConstants.NODE); return Optional.ofNullable(node); } 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; }