Static Public Member Functions

alma.acs.util.XmlNormalizer Class Reference

List of all members.

Static Public Member Functions

static String normalize (String s)
static String normalizeXMLEmbeddedTextOnly (String xmlString)
static String translate (char ch)

Detailed Description

Normalizes XML data by escaping special characters such as '&' or ' <'.

Author:
hsommer created Jul 25, 2003 10:14:34 AM

Member Function Documentation

static String alma.acs.util.XmlNormalizer.normalize ( String  s  )  [static]

Normalizes a string to not conflict with XML markup characters. Only allocates memory if the string s does contain such markup. Otherwise s is returned.

static String alma.acs.util.XmlNormalizer.normalizeXMLEmbeddedTextOnly ( String  xmlString  )  [static]

Normalizes any text in between quotes ("text") or text given as character data of mixed-content elements, all inside xmlString. Other text is left untouched. This method can be used to fix illegal text in an unparsable XML document, without destroying the XML markup itself.

Note that some rather simple parsing is used, and that there may be cases in which the result is undesirable. Thus this method should only be used as a fallback solution when the XML string can not be parsed with a regular XML parser.

Parameters:
xmlString 
Returns:
static String alma.acs.util.XmlNormalizer.translate ( char  ch  )  [static]

Translates the given character ch to its masked XML representation if this character is one of { <, >, &, ", ' }. Otherwise returns null.

Parameters:
ch 
Returns:
The corresponding XML representation such as "&amp;lt;" for a '<'.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties