XmlUtil { public static Object xpathHandlingIllegalChars(String xml, String xpath) { return xpathHandlingIllegalChars(xml, xpath, XPathConstants.STRING); }  static String xpath(String xml, String xpath); static Object xpath(String xml, String xpath, QName returnType); static Object xpathHandlingIllegalChars(String xml, String xpath); @Beta static Object xpathHandlingIllegalChars(String xml, String xpath, QName returnType);  }
@Test public void testXpathHandlingIllegalChars() throws Exception { StringBuilder xml = new StringBuilder("<a><b>myb</b><c>"); for (int i = 0; i < Integer.valueOf("FFFF", 16); i++) { String unicode = Integer.toHexString(i); xml.append("&#x"+unicode+";"); } xml.append("</c></a>"); assertEquals(XmlUtil.xpathHandlingIllegalChars(xml.toString(), "/a/b[text()]"), "myb"); }