| java.lang.Object org.apache.xml.serializer.CharInfo
CharInfo | final class CharInfo (Code) | | This class provides services that tell if a character should have
special treatement, such as entity reference substitution or normalization
of a newline character. It also provides character to entity reference
lookup.
DEVELOPERS: See Known Issue in the constructor.
|
Field Summary | |
final public static String | HTML_ENTITIES_RESOURCE The name of the HTML entities file. | final public static char | S_CARRIAGERETURN The carriage return character, which the parser should always normalize. | final public static char | S_HORIZONAL_TAB The horizontal tab character, which the parser should always normalize. | final public static char | S_LINEFEED The linefeed character, which the parser should always normalize. | final public static String | XML_ENTITIES_RESOURCE The name of the XML entities file. | final boolean | onlyQuotAmpLtGt This flag is an optimization for HTML entities. |
Method Summary | |
static CharInfo | getCharInfo(String entitiesFileName, String method) Factory that reads in a resource file that describes the mapping of
characters to entity references. | synchronized String | getOutputStringForChar(char value) Map a character to a String. | final boolean | isSpecialAttrChar(int value) Tell if the character argument that is from
an attribute value should have special treatment. | final boolean | isSpecialTextChar(int value) Tell if the character argument that is from a
text node should have special treatment. | final boolean | isTextASCIIClean(int value) This method is used to determine if an ASCII character in
a text node (not an attribute value) is "clean".
Parameters: value - the character to check (0 to 127). |
HTML_ENTITIES_RESOURCE | final public static String HTML_ENTITIES_RESOURCE(Code) | | The name of the HTML entities file.
If specified, the file will be resource loaded with the default class loader.
|
S_CARRIAGERETURN | final public static char S_CARRIAGERETURN(Code) | | The carriage return character, which the parser should always normalize.
|
S_HORIZONAL_TAB | final public static char S_HORIZONAL_TAB(Code) | | The horizontal tab character, which the parser should always normalize.
|
S_LINEFEED | final public static char S_LINEFEED(Code) | | The linefeed character, which the parser should always normalize.
|
XML_ENTITIES_RESOURCE | final public static String XML_ENTITIES_RESOURCE(Code) | | The name of the XML entities file.
If specified, the file will be resource loaded with the default class loader.
|
onlyQuotAmpLtGt | final boolean onlyQuotAmpLtGt(Code) | | This flag is an optimization for HTML entities. It false if entities
other than quot (34), amp (38), lt (60) and gt (62) are defined
in the range 0 to 127.
|
getCharInfo | static CharInfo getCharInfo(String entitiesFileName, String method)(Code) | | Factory that reads in a resource file that describes the mapping of
characters to entity references.
Resource files must be encoded in UTF-8 and have a format like:
# First char # is a comment
Entity numericValue
quot 34
amp 38
(Note: Why don't we just switch to .properties files? Oct-01 -sc)
Parameters: entitiesResource - Name of entities resource file that shouldbe loaded, which describes that mapping of characters to entity references. Parameters: method - the output method type, which should be one of "xml", "html", "text"... |
getOutputStringForChar | synchronized String getOutputStringForChar(char value)(Code) | | Map a character to a String. For example given
the character '>' this method would return the fully decorated
entity name "<".
Strings for entity references are loaded from a properties file,
but additional mappings defined through calls to defineChar2String()
are possible. Such entity reference mappings could be over-ridden.
This is reusing a stored key object, in an effort to avoid
heap activity. Unfortunately, that introduces a threading risk.
Simplest fix for now is to make it a synchronized method, or to give
up the reuse; I see very little performance difference between them.
Long-term solution would be to replace the hashtable with a sparse array
keyed directly from the character's integer value; see DTM's
string pool for a related solution.
Parameters: value - The character that should be resolved toa String, e.g. resolve '>' to "<". The String that the character is mapped to, or null if not found. |
isSpecialAttrChar | final boolean isSpecialAttrChar(int value)(Code) | | Tell if the character argument that is from
an attribute value should have special treatment.
Parameters: value - the value of a character that is in an attribute value true if the character should have any special treatment, such as when writing out attribute values, or entity references. |
isSpecialTextChar | final boolean isSpecialTextChar(int value)(Code) | | Tell if the character argument that is from a
text node should have special treatment.
Parameters: value - the value of a character that is in a text node true if the character should have any special treatment, such as when writing out attribute values, or entity references. |
isTextASCIIClean | final boolean isTextASCIIClean(int value)(Code) | | This method is used to determine if an ASCII character in
a text node (not an attribute value) is "clean".
Parameters: value - the character to check (0 to 127). true if the character can go to the writer as-is |
|
|