|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.xmlio.out.XMLEncode
public final class XMLEncode
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.
Constructor Summary | |
---|---|
XMLEncode()
|
Method Summary | |
---|---|
static boolean |
isCompatibleWithCDATABlock(String text)
Can this text be stored into a CDATA block? |
static boolean |
isWhiteSpace(String text)
Checks if this text purely consists of the white space characters ' ', TAB, NEWLINE. |
static boolean |
needsEncoding(String text)
Checks if this text needs encoding in order to be represented in XML. |
static boolean |
needsEncoding(String data,
boolean checkForAttr)
Checks if this text needs encoding in order to be represented in XML. |
static String |
xmlDecodeTextToCDATA(String pcdata)
Make CDATA out of possibly encoded PCDATA. |
static String |
xmlEncodeText(String text)
Encodes text as XML in the most suitable way, either CDATA block or PCDATA. |
static String |
xmlEncodeTextAsCDATABlock(String text)
Returns string as CDATA block if possible, otherwise null. |
static String |
xmlEncodeTextAsPCDATA(String text)
Encodes any text as PCDATA. |
static String |
xmlEncodeTextAsPCDATA(String text,
boolean forAttribute)
Encodes any text as PCDATA. |
static String |
xmlEncodeTextAsPCDATA(String text,
boolean forAttribute,
char quoteChar)
Encodes any text as PCDATA. |
static String |
xmlEncodeTextForAttribute(String text,
char quoteChar)
Makes any text fit into XML attributes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLEncode()
Method Detail |
---|
public static final boolean isWhiteSpace(String text)
public static final String xmlEncodeTextForAttribute(String text, char quoteChar)
public static final String xmlEncodeText(String text)
public static final String xmlEncodeTextAsPCDATA(String text)
public static final String xmlEncodeTextAsPCDATA(String text, boolean forAttribute)
forAttribute
- if you want
quotes and apostrophes specially treated for attributespublic static final String xmlEncodeTextAsPCDATA(String text, boolean forAttribute, char quoteChar)
forAttribute
- if you want
quotes and apostrophes specially treated for attributesquoteChar
- if this is for attributes this char
is used to quote the attribute valuepublic static final String xmlEncodeTextAsCDATABlock(String text)
public static final boolean needsEncoding(String text)
public static final boolean needsEncoding(String data, boolean checkForAttr)
checkForAttr
if you want to check for storability in
an attribute.
public static final boolean isCompatibleWithCDATABlock(String text)
public static final String xmlDecodeTextToCDATA(String pcdata)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |