Deprecated
This class was deprecated in Xerces 2.9.0. It is recommended that new applications use JAXP's Transformation API for XML (TrAX) for serializing HTML. See the Xerces documentation for more information.
isEmptyTag) or on parsing (isOptionalClosing).
Two other methods translate character references from name to value and from value to name. A small entities resource is loaded into memory the first time any of these methods is called for fast and efficient access.
| Modifier and Type | Field and Description |
|---|---|
| private static Hashtable | |
| private static Hashtable | _byChar
Table of reverse character reference mapping. |
| private static Hashtable | _byName
Table of entity name to value mapping. |
| private static Hashtable | _elemDefs
Holds element definitions. |
| private static final int | ALLOWED_HEAD
Allowed to appear in head. |
| private static final int | CLOSE_DD_DT
When opened, closes DD or DT. |
| private static final int | CLOSE_P
When opened, closes P. |
| private static final int | CLOSE_SELF
When opened, closes itself. |
| private static final int | CLOSE_TABLE
When opened, closes another table section. |
| private static final int | CLOSE_TH_TD
When opened, closes TH or TD. |
| private static final int | ELEM_CONTENT
Element contains element content only. |
| private static final int | EMPTY
Element is empty (also means only opening tag) |
| private static final String | ENTITIES_RESOURCE
Locates the HTML entities file that is loaded upon initialization. |
| public static final String | HTMLPublicId
Public identifier for HTML 4.01 (Strict) document type. |
| public static final String | HTMLSystemId
System identifier for HTML 4.01 (Strict) document type. |
| private static final int | ONLY_OPENING
Only opening tag should be printed. |
| private static final int | OPT_CLOSING
Optional closing tag. |
| private static final int | PRESERVE
Element preserve spaces. |
| public static final String | XHTMLPublicId
Public identifier for XHTML 1.0 (Strict) document type. |
| public static final String | XHTMLSystemId
System identifier for XHTML 1.0 (Strict) document type. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static int | Returns: Character code or EOF (-1)Name of character reference name)Returns the value of an HTML character reference by its name. |
| private static void | |
| private static void | |
| private static void | |
| private static void | defineEntity(String
The entity's name name, char The entity's value value)Defines a new character reference. |
| public static String | Returns: Entity's name or nullCharacter value of entity value)Returns the name of an HTML character reference based on its character value. |
| private static void | |
| public static boolean | |
| public static boolean | |
| private static boolean | |
| public static boolean | Returns: True if element contentThe element tag name (upper case) tagName)Returns true if element is declared to have element content. |
| public static boolean | Returns: True if element is emptyThe element tag name (upper case) tagName)Returns true if element is declared to be empty. |
| public static boolean | Returns: True if only opening tag should be printedThe element tag name (upper case) tagName)Returns true if element's closing tag is generally not printed. |
| public static boolean | Returns: True if closing tag impliedThe element tag name (upper case) tagName)Returns true if element's closing tag is optional and need not exist. |
| public static boolean | Returns: True if element's text content preserves spacesThe element tag name (upper case) tagName)Returns true if element's textual contents preserves spaces. |
| public static boolean |
| _boolAttrs | back to summary |
|---|---|
| private static Hashtable<K, V> _boolAttrs | |
| _byChar | back to summary |
|---|---|
| private static Hashtable<K, V> _byChar Table of reverse character reference mapping. Character codes are held as single-character strings, mapped to their reference name. | |
| _byName | back to summary |
|---|---|
| private static Hashtable<K, V> _byName Table of entity name to value mapping. Entities are held as strings, character references as Character objects. | |
| _elemDefs | back to summary |
|---|---|
| private static Hashtable<K, V> _elemDefs Holds element definitions. | |
| ALLOWED_HEAD | back to summary |
|---|---|
| private static final int ALLOWED_HEAD Allowed to appear in head. | |
| CLOSE_DD_DT | back to summary |
|---|---|
| private static final int CLOSE_DD_DT When opened, closes DD or DT. | |
| CLOSE_P | back to summary |
|---|---|
| private static final int CLOSE_P When opened, closes P. | |
| CLOSE_SELF | back to summary |
|---|---|
| private static final int CLOSE_SELF When opened, closes itself. | |
| CLOSE_TABLE | back to summary |
|---|---|
| private static final int CLOSE_TABLE When opened, closes another table section. | |
| CLOSE_TH_TD | back to summary |
|---|---|
| private static final int CLOSE_TH_TD When opened, closes TH or TD. | |
| ELEM_CONTENT | back to summary |
|---|---|
| private static final int ELEM_CONTENT Element contains element content only. | |
| EMPTY | back to summary |
|---|---|
| private static final int EMPTY Element is empty (also means only opening tag) | |
| ENTITIES_RESOURCE | back to summary |
|---|---|
| private static final String ENTITIES_RESOURCE Locates the HTML entities file that is loaded upon initialization. This file is a resource loaded with the default class loader. | |
| HTMLPublicId | back to summary |
|---|---|
| public static final String HTMLPublicId Public identifier for HTML 4.01 (Strict) document type. | |
| HTMLSystemId | back to summary |
|---|---|
| public static final String HTMLSystemId System identifier for HTML 4.01 (Strict) document type. | |
| ONLY_OPENING | back to summary |
|---|---|
| private static final int ONLY_OPENING Only opening tag should be printed. | |
| OPT_CLOSING | back to summary |
|---|---|
| private static final int OPT_CLOSING Optional closing tag. | |
| PRESERVE | back to summary |
|---|---|
| private static final int PRESERVE Element preserve spaces. | |
| XHTMLPublicId | back to summary |
|---|---|
| public static final String XHTMLPublicId Public identifier for XHTML 1.0 (Strict) document type. | |
| XHTMLSystemId | back to summary |
|---|---|
| public static final String XHTMLSystemId System identifier for XHTML 1.0 (Strict) document type. | |
| HTMLdtd | back to summary |
|---|---|
| public HTMLdtd() | |
| charFromName | back to summary |
|---|---|
| public static int charFromName(String name) Returns the value of an HTML character reference by its name. If the reference is not found or was not defined as a character reference, returns EOF (-1).
| |
| defineBoolean | back to summary |
|---|---|
| private static void defineBoolean(String tagName, String attrName) | |
| defineBoolean | back to summary |
|---|---|
| private static void defineBoolean(String tagName, String[] attrNames) | |
| defineElement | back to summary |
|---|---|
| private static void defineElement(String name, int flags) | |
| defineEntity | back to summary |
|---|---|
| private static void defineEntity(String name, char value) Defines a new character reference. The reference's name and value are supplied. Nothing happens if the character reference is already defined. Unlike internal entities, character references are a string to single character mapping. They are used to map non-ASCII characters both on parsing and printing, primarily for HTML documents. '<amp;' is an example of a character reference.
| |
| fromChar | back to summary |
|---|---|
| public static String fromChar(int value) Returns the name of an HTML character reference based on its character value. Only valid for entities defined from character references. If no such character value was defined, return null.
| |
| initialize | back to summary |
|---|---|
| private static void initialize() Initialize upon first access. Will load all the HTML character references into a list that is accessible by name or character value and is optimized for character substitution. This method may be called any number of times but will execute only once. | |
| isBoolean | back to summary |
|---|---|
| public static boolean isBoolean(String tagName, String attrName) Returns true if the specified attribute is a boolean and should be printed without the value. This applies to attributes that are true if they exist, such as selected (OPTION/INPUT). | |
| isClosing | back to summary |
|---|---|
| public static boolean isClosing(String tagName, String openTag) Returns true if the opening of one element (tagName) implies the closing of another open element (openTag). For example, every opening LI will close the previously open LI, and every opening BODY will close the previously open HEAD. | |
| isElement | back to summary |
|---|---|
| private static boolean isElement(String name, int flag) | |
| isElementContent | back to summary |
|---|---|
| public static boolean isElementContent(String tagName) Returns true if element is declared to have element content. Whitespaces appearing inside element content will be ignored, other text will simply report an error.
| |
| isEmptyTag | back to summary |
|---|---|
| public static boolean isEmptyTag(String tagName) Returns true if element is declared to be empty. HTML elements are defines as empty in the DTD, not by the document syntax.
| |
| isOnlyOpening | back to summary |
|---|---|
| public static boolean isOnlyOpening(String tagName) Returns true if element's closing tag is generally not printed. For example, LI should not print the closing tag.
| |
| isOptionalClosing | back to summary |
|---|---|
| public static boolean isOptionalClosing(String tagName) Returns true if element's closing tag is optional and need not exist. An error will not be reported for such elements if they are not closed. For example, LI is most often not closed.
| |
| isPreserveSpace | back to summary |
|---|---|
| public static boolean isPreserveSpace(String tagName) Returns true if element's textual contents preserves spaces. This only applies to PRE and TEXTAREA, all other HTML elements do not preserve space.
| |
| isURI | back to summary |
|---|---|
| public static boolean isURI(String tagName, String attrName) Returns true if the specified attribute it a URI and should be escaped appropriately. In HTML URIs are escaped differently than normal attributes. | |