| |
|
| java.lang.Object org.apache.commons.betwixt.XMLUtils
XMLUtils | public class XMLUtils (Code) | | XMLUtils contains basic utility methods for XML.
The code for
XMLUtils.isWellFormedXMLName is based on code in
org.apache.xerces.util.XMLChar
in Apache Xerces.
The authors of this class are credited below.
author: Glenn Marcy, IBM author: Andy Clark, IBM author: Eric Ye, IBM author: Arnaud Le Hors, IBM author: Rahul Srivastava, Sun Microsystems Inc. author: Robert Burrell Donkin since: 0.5 |
Constructor Summary | |
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. |
Method Summary | |
final public static String | escapeAttributeValue(Object value) Escape the toString of the given object. | final public static String | escapeBodyValue(Object value) Escape the toString of the given object. | final public static String | escapeCDATAContent(String content) Escapes the given content suitable for insertion within a
CDATA sequence.
Within a CDATA section, only the CDEnd
string ']]>' is recognized as markup.
Parameters: content - the body content whose character data should be escaped in a way appropriate for use within a CDATA section of xml. | final public static void | escapeCDATAContent(StringBuffer bufferedContent) Escapes the given content suitable for insertion within a
CDATA sequence. | public static boolean | isNameChar(int c) Returns true if the specified character is a valid name
character as defined by the XML 1.0 specification.
Parameters: c - The character to check. | public 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.
Parameters: c - The character to check. | public static boolean | isWellFormedXMLName(String name) Is this string a well formed xml name?
Only certain characters are allowed in well formed element and attribute
names in xml. |
AMPERSAND_ENTITY | final public static String AMPERSAND_ENTITY(Code) | | Escaped & entity
|
APOSTROPHE_ENTITY | final public static String APOSTROPHE_ENTITY(Code) | | Escaped ' entity
|
GREATER_THAN_ENTITY | final public static String GREATER_THAN_ENTITY(Code) | | Escaped > entity
|
LESS_THAN_ENTITY | final public static String LESS_THAN_ENTITY(Code) | | Escaped < entity
|
QUOTE_ENTITY | final public static String QUOTE_ENTITY(Code) | | Escaped " entity
|
XMLUtils | public XMLUtils()(Code) | | 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.
|
escapeAttributeValue | final public static String escapeAttributeValue(Object value)(Code) | | Escape the toString of the given object.
For use in an attribute value.
Parameters: value - escape value.toString() text with characters restricted (for use in attributes) escaped |
escapeBodyValue | final public static String escapeBodyValue(Object value)(Code) | | Escape the toString of the given object.
For use as body text.
Parameters: value - escape value.toString() text with escaped delimiters |
escapeCDATAContent | final public static String escapeCDATAContent(String content)(Code) | | Escapes the given content suitable for insertion within a
CDATA sequence.
Within a CDATA section, only the CDEnd
string ']]>' is recognized as markup.
Parameters: content - the body content whose character data should be escaped in a way appropriate for use within a CDATA section of xml. escaped character data, not null |
escapeCDATAContent | final public static void escapeCDATAContent(StringBuffer bufferedContent)(Code) | | Escapes the given content suitable for insertion within a
CDATA sequence.
Within a CDATA section, only the CDEnd
string ']]>' is recognized as markup.
Parameters: bufferedContent - the body content within a buffer whose character data should be escaped in a way appropriate for use within a CDATA section of xml |
isNameChar | public static boolean isNameChar(int c)(Code) | | Returns true if the specified character is a valid name
character as defined by the XML 1.0 specification.
Parameters: c - The character to check. true if this is an XML name character |
isNameStartChar | public static boolean isNameStartChar(int c)(Code) | | Returns true if the specified character is a valid name start
character as defined in the XML 1.0 specification.
Parameters: c - The character to check. trus if this is an XML name start character |
isWellFormedXMLName | public static boolean isWellFormedXMLName(String name)(Code) | | 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.
Parameters: name - the String to be checked for use as an xml attribute or element name. Returns false if name is null true if this string would be a well-formed name |
|
|
|