@Test public void createNodeListUsingXPathExpressionTest() throws XPathExpressionException, UnsupportedEncodingException { NodeList result = XMLUtils.createNodeListUsingXPathExpression("/parentNode/childNode", testXml); assertThat(result.getLength(), equalTo(5)); assertThat(result.item(0).getTextContent(), equalTo("1")); assertThat(result.item(1).getTextContent(), equalTo("2")); assertThat(result.item(2).getTextContent(), equalTo("3")); }
public static NodeList createNodeListUsingXPathExpression(String expression, String xml) throws XPathExpressionException, UnsupportedEncodingException { return (NodeList) XMLUtils.createXPathExpression(expression).evaluate(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))), XPathConstants.NODESET); }
XMLUtils { public static NodeList createNodeListUsingXPathExpression(String expression, String xml) throws XPathExpressionException, UnsupportedEncodingException { return (NodeList) XMLUtils.createXPathExpression(expression).evaluate(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))), XPathConstants.NODESET); } }
XMLUtils { public static NodeList createNodeListUsingXPathExpression(String expression, String xml) throws XPathExpressionException, UnsupportedEncodingException { return (NodeList) XMLUtils.createXPathExpression(expression).evaluate(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))), XPathConstants.NODESET); } private  XMLUtils(); }
XMLUtils { public static NodeList createNodeListUsingXPathExpression(String expression, String xml) throws XPathExpressionException, UnsupportedEncodingException { return (NodeList) XMLUtils.createXPathExpression(expression).evaluate(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))), XPathConstants.NODESET); } private  XMLUtils(); static String transformXML(final InputStream xml, final InputStream xslt); static String createPrettyXML(Document document); static XPathExpression createXPathExpression(final String expression); static Boolean createBooleanUsingXPathExpression(String expression, String xml); static NodeList createNodeListUsingXPathExpression(String expression, String xml); static Node createNodeUsingXPathExpression(String expression, String xml); }
XMLUtils { public static NodeList createNodeListUsingXPathExpression(String expression, String xml) throws XPathExpressionException, UnsupportedEncodingException { return (NodeList) XMLUtils.createXPathExpression(expression).evaluate(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))), XPathConstants.NODESET); } private  XMLUtils(); static String transformXML(final InputStream xml, final InputStream xslt); static String createPrettyXML(Document document); static XPathExpression createXPathExpression(final String expression); static Boolean createBooleanUsingXPathExpression(String expression, String xml); static NodeList createNodeListUsingXPathExpression(String expression, String xml); static Node createNodeUsingXPathExpression(String expression, String xml);  }