Module jonix.xml

Class XmlUtil

java.lang.Object
com.tectonica.xmlchunk.XmlUtil

public class XmlUtil extends Object
  • Constructor Details

    • XmlUtil

      public XmlUtil()
  • Method Details

    • elementToString

      public static String elementToString(Element elem, boolean strip)
      Transforms a DOM Element into an XML text
      Parameters:
      elem - the element to transform into text
      strip - if true, removes the containing tag of the XML node
      Returns:
      an XML text representation of the given element
    • unescape

      public static String unescape(String escaped)
      Transforms an escaped XML into the original, "un-escaped" value (for example turn &lt;Hello&gt; into <Hello>).

      If the input contains no & character it is returned as-is (preserving any actual XML markup). Standard entity references (&lt;, &gt;, &amp;, &apos;, &quot;) and numeric character references (&#NNN; / &#xHHH;) are decoded; unknown named entities are left unchanged.

      Parameters:
      escaped - the (possibly escaped) XML string
      Returns:
      the un-escaped string