| Constructor and Description |
|---|
XMLs() |
| Modifier and Type | Method and Description |
|---|---|
static String |
encodeAttribute(String value)
Encodes a value such that it could be used as XML attribute.
|
static String |
encodeText(String value)
Encodes a value such that it could be enclosed by an XML element.
|
static StringBuffer |
encodeText(StringBuffer sb,
String value)
Encodes a value and appends it to a string buffer,
such that it could be enclosed by an XML element.
|
static StringBuffer |
encodeText(StringBuffer sb,
String value,
int begin,
int end)
Encodes a value of the specified range,
and appends it to a string buffer,
such that it could be enclosed by an XML element.
|
static String |
escapeXML(char cc)
Escapes a character into a string if it is a special XML character,
returns null if not a special character.
|
static String |
escapeXML(String s)
Encodes a string that special characters are quoted to be compatible
with HTML/XML.
|
static String |
toXMLName(String name)
Converting a name to a valid XML name.
|
public static final String toXMLName(String name)
public static final String encodeAttribute(String value)
public static final String encodeText(String value)
Note: It is sometime improper to use CDATA if the text contains CDATA, too. The simplest way is NOT to use CDATA but encoding the string by this method.
public static final StringBuffer encodeText(StringBuffer sb, String value)
Note: It is sometime improper to use CDATA if the text contains CDATA, too. The simplest way is NOT to use CDATA but encoding the string by this method.
public static final StringBuffer encodeText(StringBuffer sb, String value, int begin, int end)
Note: It is sometime improper to use CDATA if the text contains CDATA, too. The simplest way is NOT to use CDATA but encoding the string by this method.
value - the string to encodebegin - the beginning index, inclusive of the string to encode (i.e., value), includedend - the ending index, exclusive of the string to encode (i.e., value), excludedpublic static final String escapeXML(String s)
s - the string to quote; null is OKpublic static final String escapeXML(char cc)
Copyright © 2018. All rights reserved.