Class XMLEncode

java.lang.Object
org.apache.maven.shared.utils.xml.XMLEncode

final class XMLEncode extends Object
Collection of XML encoding/decoding helpers.
This is all about the special characters & and <, and for attributes " and '. These must be encoded/decoded from/to XML.
  • Field Details

    • CDATA_BLOCK_THRESHOLD_LENGTH

      private static final int CDATA_BLOCK_THRESHOLD_LENGTH
      See Also:
    • DEFAULT_QUOTE_CHAR

      private static final char DEFAULT_QUOTE_CHAR
      See Also:
  • Constructor Details

    • XMLEncode

      XMLEncode()
  • Method Details

    • xmlEncodeText

      static void xmlEncodeText(String text, Writer writer) throws IOException
      Throws:
      IOException
    • xmlEncodeTextAsPCDATA

      static void xmlEncodeTextAsPCDATA(String text, boolean forAttribute, char quoteChar, Writer n) throws IOException
      Throws:
      IOException
    • xmlEncodeTextAsCDATABlock

      private static String xmlEncodeTextAsCDATABlock(String text)
      Returns string as CDATA block if possible, otherwise null.
    • needsEncoding

      private static boolean needsEncoding(String text)
      Checks if this text needs encoding in order to be represented in XML.