@Test public void createBooleanUsingXPathExpressionTest() throws XPathExpressionException, UnsupportedEncodingException { Boolean result = XMLUtils.createBooleanUsingXPathExpression("/parentNode/childNode[4]", testXml); assertThat(result, equalTo(Boolean.TRUE)); result = XMLUtils.createBooleanUsingXPathExpression("/parentNode/childNode[6]", testXml); assertThat(result, equalTo(Boolean.FALSE)); }
public static Boolean createBooleanUsingXPathExpression(String expression, String xml) throws XPathExpressionException, UnsupportedEncodingException { return (Boolean) XMLUtils.createXPathExpression(expression).evaluate(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))), XPathConstants.BOOLEAN); }
XMLUtils { public static Boolean createBooleanUsingXPathExpression(String expression, String xml) throws XPathExpressionException, UnsupportedEncodingException { return (Boolean) XMLUtils.createXPathExpression(expression).evaluate(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))), XPathConstants.BOOLEAN); } }
XMLUtils { public static Boolean createBooleanUsingXPathExpression(String expression, String xml) throws XPathExpressionException, UnsupportedEncodingException { return (Boolean) XMLUtils.createXPathExpression(expression).evaluate(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))), XPathConstants.BOOLEAN); } private  XMLUtils(); }
XMLUtils { public static Boolean createBooleanUsingXPathExpression(String expression, String xml) throws XPathExpressionException, UnsupportedEncodingException { return (Boolean) XMLUtils.createXPathExpression(expression).evaluate(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))), XPathConstants.BOOLEAN); } 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 Boolean createBooleanUsingXPathExpression(String expression, String xml) throws XPathExpressionException, UnsupportedEncodingException { return (Boolean) XMLUtils.createXPathExpression(expression).evaluate(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))), XPathConstants.BOOLEAN); } 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);  }