| java.lang.Object org.jasig.portal.serialize.HTMLdtd
HTMLdtd | final public class HTMLdtd (Code) | | Utility class for accessing information specific to HTML documents.
The HTML DTD is expressed as three utility function groups. Two methods
allow for checking whether an element requires an open tag on printing
(
HTMLdtd.isEmptyTag ) or on parsing (
HTMLdtd.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.
version: $Revision: 36559 $ $Date: 2006-04-28 11:38:13 -0700 (Fri, 28 Apr 2006) $ author: Assaf Arkin |
Field Summary | |
final public static String | HTMLPublicId Public identifier for HTML 4.01 (Strict) document type. | final public static String | HTMLSystemId System identifier for HTML 4.01 (Strict) document type. | final public static String | XHTMLPublicId Public identifier for XHTML 1.0 (Strict) document type. | final public static String | XHTMLSystemId System identifier for XHTML 1.0 (Strict) document type. |
Method Summary | |
public static int | charFromName(String name) Returns the value of an HTML character reference by its name. | public static String | fromChar(int value) Returns the name of an HTML character reference based on its character
value. | public static boolean | isBoolean(String tagName, String attrName) Returns true if the specified attribute is a boolean and should be
printed without the value. | 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). | public static boolean | isElementContent(String tagName) Returns true if element is declared to have element content. | public static boolean | isEmptyTag(String tagName) Returns true if element is declared to be empty. | public static boolean | isOnlyOpening(String tagName) Returns true if element's closing tag is generally not printed. | public static boolean | isOptionalClosing(String tagName) Returns true if element's closing tag is optional and need not
exist. | public static boolean | isPreserveSpace(String tagName) Returns true if element's textual contents preserves spaces. | public static boolean | isURI(String tagName, String attrName) Returns true if the specified attribute it a URI and should be
escaped appropriately. |
HTMLPublicId | final public static String HTMLPublicId(Code) | | Public identifier for HTML 4.01 (Strict) document type.
|
HTMLSystemId | final public static String HTMLSystemId(Code) | | System identifier for HTML 4.01 (Strict) document type.
|
XHTMLPublicId | final public static String XHTMLPublicId(Code) | | Public identifier for XHTML 1.0 (Strict) document type.
|
XHTMLSystemId | final public static String XHTMLSystemId(Code) | | System identifier for XHTML 1.0 (Strict) document type.
|
charFromName | public static int charFromName(String name)(Code) | | 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).
Parameters: name - Name of character reference Character code or EOF (-1) |
fromChar | public static String fromChar(int value)(Code) | | 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.
Parameters: value - Character value of entity Entity's name or null |
isBoolean | public static boolean isBoolean(String tagName, String attrName)(Code) | | 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).
Parameters: tagName - The element's tag name Parameters: attrName - The attribute's name |
isClosing | public static boolean isClosing(String tagName, String openTag)(Code) | | 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.
Parameters: tagName - The newly opened element Parameters: openTag - The already opened element True if closing tag closes opening tag |
isElementContent | public static boolean isElementContent(String tagName)(Code) | | 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.
Parameters: tagName - The element tag name (upper case) True if element content |
isEmptyTag | public static boolean isEmptyTag(String tagName)(Code) | | Returns true if element is declared to be empty. HTML elements are
defines as empty in the DTD, not by the document syntax.
Parameters: tagName - The element tag name (upper case) True if element is empty |
isOnlyOpening | public static boolean isOnlyOpening(String tagName)(Code) | | Returns true if element's closing tag is generally not printed.
For example, LI should not print the closing tag.
Parameters: tagName - The element tag name (upper case) True if only opening tag should be printed |
isOptionalClosing | public static boolean isOptionalClosing(String tagName)(Code) | | 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.
Parameters: tagName - The element tag name (upper case) True if closing tag implied |
isPreserveSpace | public static boolean isPreserveSpace(String tagName)(Code) | | Returns true if element's textual contents preserves spaces.
This only applies to PRE and TEXTAREA, all other HTML elements
do not preserve space.
Parameters: tagName - The element tag name (upper case) True if element's text content preserves spaces |
isURI | public static boolean isURI(String tagName, String attrName)(Code) | | Returns true if the specified attribute it a URI and should be
escaped appropriately. In HTML URIs are escaped differently
than normal attributes.
Parameters: tagName - The element's tag name Parameters: attrName - The attribute's name |
|
|