@Test void unescape() { assertEquals("&'\"<>", XMLUtils.unescape("&amp;&apos;&quot;&lt;&gt;"), "Failed to unescaped named entities"); assertEquals("&'\"<>", XMLUtils.unescape("&#38;&#39;&#34;&#60;&#62;"), "Failed to unescaped decimal entities"); assertEquals("&'\"<>", XMLUtils.unescape("&#038;&#0039;&#00034;&#000060;&#0000062;"), "Failed to unescaped decimal entities with leading zeros"); assertEquals("&'\"<<>>", XMLUtils.unescape("&#x26;&#x27;&#x22;&#x3c;&#x3C;&#x3e;&#x3E;"), "Failed to unescaped hexadecimal entities"); assertEquals("&'\"<<>>", XMLUtils.unescape("&#x026;&#x0027;&#x00022;&#x00003c;&#x0003C;&#x003e;&#x03E;"), "Failed to unescaped hexadecimal entities with leading zeros"); }
@Deprecated public static String unescape(Object content) { if (content == null) { return null; } String str = String.valueOf(content); str = APOS_PATTERN.matcher(str).replaceAll("'"); str = QUOT_PATTERN.matcher(str).replaceAll("\""); str = LT_PATTERN.matcher(str).replaceAll("<"); str = GT_PATTERN.matcher(str).replaceAll(">"); str = AMP_PATTERN.matcher(str).replaceAll("&"); str = LCURL_PATTERN.matcher(str).replaceAll("{"); return str; }
XMLUtils { @Deprecated public static String unescape(Object content) { if (content == null) { return null; } String str = String.valueOf(content); str = APOS_PATTERN.matcher(str).replaceAll("'"); str = QUOT_PATTERN.matcher(str).replaceAll("\""); str = LT_PATTERN.matcher(str).replaceAll("<"); str = GT_PATTERN.matcher(str).replaceAll(">"); str = AMP_PATTERN.matcher(str).replaceAll("&"); str = LCURL_PATTERN.matcher(str).replaceAll("{"); return str; } }
XMLUtils { @Deprecated public static String unescape(Object content) { if (content == null) { return null; } String str = String.valueOf(content); str = APOS_PATTERN.matcher(str).replaceAll("'"); str = QUOT_PATTERN.matcher(str).replaceAll("\""); str = LT_PATTERN.matcher(str).replaceAll("<"); str = GT_PATTERN.matcher(str).replaceAll(">"); str = AMP_PATTERN.matcher(str).replaceAll("&"); str = LCURL_PATTERN.matcher(str).replaceAll("{"); return str; } private  XMLUtils(); }
XMLUtils { @Deprecated public static String unescape(Object content) { if (content == null) { return null; } String str = String.valueOf(content); str = APOS_PATTERN.matcher(str).replaceAll("'"); str = QUOT_PATTERN.matcher(str).replaceAll("\""); str = LT_PATTERN.matcher(str).replaceAll("<"); str = GT_PATTERN.matcher(str).replaceAll(">"); str = AMP_PATTERN.matcher(str).replaceAll("&"); str = LCURL_PATTERN.matcher(str).replaceAll("{"); return str; } private  XMLUtils(); static String extractXML(Node node, int start, int length); static String escapeXMLComment(String content); static String unescapeXMLComment(String content); @Deprecated static String escape(Object content); @Unstable static String escape(String content); @Deprecated static String escapeAttributeValue(Object content); @Unstable static String escapeAttributeValue(String content); @Unstable static String escapeElementText(String content); @Deprecated static String escapeElementContent(Object content); @Deprecated static String unescape(Object content); static Document createDOMDocument(); static Document parse(LSInput source); static String serialize(Node node); static String serialize(Node node, boolean withXmlDeclaration); static String transform(Source xml, Source xslt); static String formatXMLContent(String content); }
XMLUtils { @Deprecated public static String unescape(Object content) { if (content == null) { return null; } String str = String.valueOf(content); str = APOS_PATTERN.matcher(str).replaceAll("'"); str = QUOT_PATTERN.matcher(str).replaceAll("\""); str = LT_PATTERN.matcher(str).replaceAll("<"); str = GT_PATTERN.matcher(str).replaceAll(">"); str = AMP_PATTERN.matcher(str).replaceAll("&"); str = LCURL_PATTERN.matcher(str).replaceAll("{"); return str; } private  XMLUtils(); static String extractXML(Node node, int start, int length); static String escapeXMLComment(String content); static String unescapeXMLComment(String content); @Deprecated static String escape(Object content); @Unstable static String escape(String content); @Deprecated static String escapeAttributeValue(Object content); @Unstable static String escapeAttributeValue(String content); @Unstable static String escapeElementText(String content); @Deprecated static String escapeElementContent(Object content); @Deprecated static String unescape(Object content); static Document createDOMDocument(); static Document parse(LSInput source); static String serialize(Node node); static String serialize(Node node, boolean withXmlDeclaration); static String transform(Source xml, Source xslt); static String formatXMLContent(String content);  }