@Test public void testGetNodes() throws Exception { String XML_SIGNATURE_XPATH = " + " and " + "namespace-uri()='http: NodeList nodes; nodes = Xml.getNodes(classUnderTest.getDocument(), XML_SIGNATURE_XPATH); assertEquals(0, nodes.getLength()); nodes = classUnderTest.getNodes(XML_SIGNATURE_XPATH); assertEquals(0, nodes.getLength()); nodes = Xml.getNodes(classUnderTestMoreNodes.getDocument(), XML_SIGNATURE_XPATH); assertEquals(3, nodes.getLength()); nodes = classUnderTestMoreNodes.getNodes(XML_SIGNATURE_XPATH); assertEquals(3, nodes.getLength()); }
public NodeList getNodes(String xpath) { XPathExpression expr; Object result; try { expr = xpathObj.compile(xpath); result = expr.evaluate(doc, XPathConstants.NODESET); } catch (XPathExpressionException ex) { Log.warn("getNodes(" + xpath + ")", ex); return null; } return (NodeList) result; }
Xml { public NodeList getNodes(String xpath) { XPathExpression expr; Object result; try { expr = xpathObj.compile(xpath); result = expr.evaluate(doc, XPathConstants.NODESET); } catch (XPathExpressionException ex) { Log.warn("getNodes(" + xpath + ")", ex); return null; } return (NodeList) result; } }
Xml { public NodeList getNodes(String xpath) { XPathExpression expr; Object result; try { expr = xpathObj.compile(xpath); result = expr.evaluate(doc, XPathConstants.NODESET); } catch (XPathExpressionException ex) { Log.warn("getNodes(" + xpath + ")", ex); return null; } return (NodeList) result; } Xml(String source);  Xml(InputStream source);  Xml(Document doc); }
Xml { public NodeList getNodes(String xpath) { XPathExpression expr; Object result; try { expr = xpathObj.compile(xpath); result = expr.evaluate(doc, XPathConstants.NODESET); } catch (XPathExpressionException ex) { Log.warn("getNodes(" + xpath + ")", ex); return null; } return (NodeList) result; } Xml(String source);  Xml(InputStream source);  Xml(Document doc); String getValue(String xpath); NodeList getNodes(String xpath); Node addNode(Node parent, String newNode); void removeNodes(String xpath); @Override String toString(); String toString(String xpath); String toPrettyString(String xpath); static Node addNodeIfNotPresent(Node parent, String newNode); static NodeList getNodes(Node node, String xpath); static Node getFirstNode(Node node, String xpath); String getAttributeValue(String xpathToNode, String attribName); static String getAttribute(Node node, String name); int addNodeRecursively(InputStream newXml, String xpath, boolean addDuplicates); static boolean contains(NodeList list, Node node); Document getDocument(); void toOutputStream(OutputStream os); }
Xml { public NodeList getNodes(String xpath) { XPathExpression expr; Object result; try { expr = xpathObj.compile(xpath); result = expr.evaluate(doc, XPathConstants.NODESET); } catch (XPathExpressionException ex) { Log.warn("getNodes(" + xpath + ")", ex); return null; } return (NodeList) result; } Xml(String source);  Xml(InputStream source);  Xml(Document doc); String getValue(String xpath); NodeList getNodes(String xpath); Node addNode(Node parent, String newNode); void removeNodes(String xpath); @Override String toString(); String toString(String xpath); String toPrettyString(String xpath); static Node addNodeIfNotPresent(Node parent, String newNode); static NodeList getNodes(Node node, String xpath); static Node getFirstNode(Node node, String xpath); String getAttributeValue(String xpathToNode, String attribName); static String getAttribute(Node node, String name); int addNodeRecursively(InputStream newXml, String xpath, boolean addDuplicates); static boolean contains(NodeList list, Node node); Document getDocument(); void toOutputStream(OutputStream os);  }