|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.betwixt.XMLUtils
public class XMLUtils
XMLUtils
contains basic utility methods for XML.
The code for isWellFormedXMLName(java.lang.String)
is based on code in
org.apache.xerces.util.XMLChar
in Apache Xerces.
The authors of this class are credited below.
Field Summary | |
---|---|
static java.lang.String |
AMPERSAND_ENTITY
Escaped & entity |
static java.lang.String |
APOSTROPHE_ENTITY
Escaped ' entity |
static java.lang.String |
GREATER_THAN_ENTITY
Escaped > entity |
static java.lang.String |
LESS_THAN_ENTITY
Escaped < entity |
static java.lang.String |
QUOTE_ENTITY
Escaped " entity |
Constructor Summary | |
---|---|
XMLUtils()
Constructor for use by tools that required JavaBean instances. |
Method Summary | |
---|---|
static java.lang.String |
escapeAttributeValue(java.lang.Object value)
Escape the toString of the given object. |
static java.lang.String |
escapeBodyValue(java.lang.Object value)
Escape the toString of the given object. |
static java.lang.String |
escapeCDATAContent(java.lang.String content)
Escapes the given content suitable for insertion within a CDATA sequence. |
static void |
escapeCDATAContent(java.lang.StringBuffer bufferedContent)
Escapes the given content suitable for insertion within a CDATA sequence. |
static boolean |
isNameChar(int c)
Returns true if the specified character is a valid name character as defined by the XML 1.0 specification. |
static boolean |
isNameStartChar(int c)
Returns true if the specified character is a valid name start character as defined in the XML 1.0 specification. |
static boolean |
isWellFormedXMLName(java.lang.String name)
Is this string a well formed xml name? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LESS_THAN_ENTITY
<
entity
public static final java.lang.String GREATER_THAN_ENTITY
>
entity
public static final java.lang.String AMPERSAND_ENTITY
&
entity
public static final java.lang.String APOSTROPHE_ENTITY
'
entity
public static final java.lang.String QUOTE_ENTITY
"
entity
Constructor Detail |
---|
public XMLUtils()
Constructor for use by tools that required JavaBean
instances.
This constructor is public only
to permit tools that require a JavaBean instance to operate.
XMLUtils
instances should not be constructed in standard
programming. Instead, the class methods should be called directly.
Method Detail |
---|
public static final java.lang.String escapeBodyValue(java.lang.Object value)
Escape the toString
of the given object.
For use as body text.
value
- escape value.toString()
public static final java.lang.String escapeAttributeValue(java.lang.Object value)
Escape the toString
of the given object.
For use in an attribute value.
value
- escape value.toString()
public static final java.lang.String escapeCDATAContent(java.lang.String content)
CDATA
sequence.
Within a CDATA
section, only the CDEnd
string ']]>' is recognized as markup.
content
- the body content whose character data should
be escaped in a way appropriate for use within a CDATA
section of xml.
public static final void escapeCDATAContent(java.lang.StringBuffer bufferedContent)
CDATA
sequence.
Within a CDATA
section, only the CDEnd
string ']]>' is recognized as markup.
bufferedContent
- the body content within a buffer
whose character data should
be escaped in a way appropriate for use within a CDATA
section of xmlpublic static boolean isWellFormedXMLName(java.lang.String name)
Is this string a well formed xml name?
Only certain characters are allowed in well formed element and attribute names in xml. For example, white space is not allowed in a name.
The code for this method is based on code in
org.apache.xerces.util.XMLChar
in Apache Xerces.
The authors of this class are credited at the top of this class.
name
- the String
to be checked for use as an xml attribute
or element name. Returns false if name
is null
public static boolean isNameChar(int c)
c
- The character to check.
public static boolean isNameStartChar(int c)
c
- The character to check.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |