Class XMLCoder

Object
XMLCoder

public class XMLCoder extends Object
Encode and decode XML strings.
Author:
Christoph Hauert
  • Field Details

    • XMLDecode

      private static final Map<String, Character> XMLDecode
      Lookup table for decoding XML strings.
    • XMLEncode

      private static final Map<Character, String> XMLEncode
      Lookup table for encoding XML strings.
    • HTMLDecode

      private static final Map<String, Character> HTMLDecode
      Lookup table for decoding HTML strings.
  • Constructor Details

    • XMLCoder

      private XMLCoder()
      Suppresses default constructor, ensuring non-instantiability.
  • Method Details

    • encode

      public static String encode(String string)
      Encode string as XML. Encoded HTML values are converted to UTF-8 characters except for the five XML entities &amp;, &apos; &lt; &gt; &quot;.
      Parameters:
      string - the string to encode in XML
      Returns:
      the encoded string
    • decode

      public static String decode(String string)
      Decode XML string.
      Parameters:
      string - the XML string to decode
      Returns:
      the decoded string