Class XMLEncode
- java.lang.Object
-
- org.apache.maven.shared.utils.xml.XMLEncode
-
final class XMLEncode extends java.lang.ObjectCollection 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 Summary
Fields Modifier and Type Field Description private static intCDATA_BLOCK_THRESHOLD_LENGTHprivate static charDEFAULT_QUOTE_CHAR
-
Constructor Summary
Constructors Constructor Description XMLEncode()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static booleanneedsEncoding(java.lang.String text)Checks if this text needs encoding in order to be represented in XML.(package private) static voidxmlEncodeText(java.lang.String text, java.io.Writer writer)private static java.lang.StringxmlEncodeTextAsCDATABlock(java.lang.String text)Returns string as CDATA block if possible, otherwise null.(package private) static voidxmlEncodeTextAsPCDATA(java.lang.String text, boolean forAttribute, char quoteChar, java.io.Writer n)
-
-
-
Field Detail
-
CDATA_BLOCK_THRESHOLD_LENGTH
private static final int CDATA_BLOCK_THRESHOLD_LENGTH
- See Also:
- Constant Field Values
-
DEFAULT_QUOTE_CHAR
private static final char DEFAULT_QUOTE_CHAR
- See Also:
- Constant Field Values
-
-
Method Detail
-
xmlEncodeText
static void xmlEncodeText(java.lang.String text, java.io.Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
xmlEncodeTextAsPCDATA
static void xmlEncodeTextAsPCDATA(java.lang.String text, boolean forAttribute, char quoteChar, java.io.Writer n) throws java.io.IOException- Throws:
java.io.IOException
-
xmlEncodeTextAsCDATABlock
private static java.lang.String xmlEncodeTextAsCDATABlock(java.lang.String text)
Returns string as CDATA block if possible, otherwise null.
-
needsEncoding
private static boolean needsEncoding(java.lang.String text)
Checks if this text needs encoding in order to be represented in XML.
-
-