Class HTMLdtd


  • public final class HTMLdtd
    extends Object
    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.
    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 (isEmptyTag(java.lang.String)) or on parsing (isOptionalClosing(java.lang.String)).

    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$ $Date$
    Author:
    Assaf Arkin
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String HTMLPublicId
      Deprecated.
      Public identifier for HTML 4.01 (Strict) document type.
      static String HTMLSystemId
      Deprecated.
      System identifier for HTML 4.01 (Strict) document type.
      static String XHTMLPublicId
      Deprecated.
      Public identifier for XHTML 1.0 (Strict) document type.
      static String XHTMLSystemId
      Deprecated.
      System identifier for XHTML 1.0 (Strict) document type.
    • Constructor Summary

      Constructors 
      Constructor Description
      HTMLdtd()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static int charFromName​(String name)
      Deprecated.
      Returns the value of an HTML character reference by its name.
      static String fromChar​(int value)
      Deprecated.
      Returns the name of an HTML character reference based on its character value.
      static boolean isBoolean​(String tagName, String attrName)
      Deprecated.
      Returns true if the specified attribute is a boolean and should be printed without the value.
      static boolean isClosing​(String tagName, String openTag)
      Deprecated.
      Returns true if the opening of one element (tagName) implies the closing of another open element (openTag).
      static boolean isElementContent​(String tagName)
      Deprecated.
      Returns true if element is declared to have element content.
      static boolean isEmptyTag​(String tagName)
      Deprecated.
      Returns true if element is declared to be empty.
      static boolean isOnlyOpening​(String tagName)
      Deprecated.
      Returns true if element's closing tag is generally not printed.
      static boolean isOptionalClosing​(String tagName)
      Deprecated.
      Returns true if element's closing tag is optional and need not exist.
      static boolean isPreserveSpace​(String tagName)
      Deprecated.
      Returns true if element's textual contents preserves spaces.
      static boolean isURI​(String tagName, String attrName)
      Deprecated.
      Returns true if the specified attribute it a URI and should be escaped appropriately.
    • Field Detail

      • HTMLPublicId

        public static final String HTMLPublicId
        Deprecated.
        Public identifier for HTML 4.01 (Strict) document type.
        See Also:
        Constant Field Values
      • HTMLSystemId

        public static final String HTMLSystemId
        Deprecated.
        System identifier for HTML 4.01 (Strict) document type.
        See Also:
        Constant Field Values
      • XHTMLPublicId

        public static final String XHTMLPublicId
        Deprecated.
        Public identifier for XHTML 1.0 (Strict) document type.
        See Also:
        Constant Field Values
      • XHTMLSystemId

        public static final String XHTMLSystemId
        Deprecated.
        System identifier for XHTML 1.0 (Strict) document type.
        See Also:
        Constant Field Values
    • Constructor Detail

      • HTMLdtd

        public HTMLdtd()
        Deprecated.
    • Method Detail

      • isEmptyTag

        public static boolean isEmptyTag​(String tagName)
        Deprecated.
        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)
        Returns:
        True if element is empty
      • isElementContent

        public static boolean isElementContent​(String tagName)
        Deprecated.
        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)
        Returns:
        True if element content
      • isPreserveSpace

        public static boolean isPreserveSpace​(String tagName)
        Deprecated.
        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)
        Returns:
        True if element's text content preserves spaces
      • isOptionalClosing

        public static boolean isOptionalClosing​(String tagName)
        Deprecated.
        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)
        Returns:
        True if closing tag implied
      • isOnlyOpening

        public static boolean isOnlyOpening​(String tagName)
        Deprecated.
        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)
        Returns:
        True if only opening tag should be printed
      • isClosing

        public static boolean isClosing​(String tagName,
                                        String openTag)
        Deprecated.
        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
        openTag - The already opened element
        Returns:
        True if closing tag closes opening tag
      • isURI

        public static boolean isURI​(String tagName,
                                    String attrName)
        Deprecated.
        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
        attrName - The attribute's name
      • isBoolean

        public static boolean isBoolean​(String tagName,
                                        String attrName)
        Deprecated.
        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
        attrName - The attribute's name
      • charFromName

        public static int charFromName​(String name)
        Deprecated.
        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
        Returns:
        Character code or EOF (-1)
      • fromChar

        public static String fromChar​(int value)
        Deprecated.
        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
        Returns:
        Entity's name or null