public class DTD extends Object implements DTDConstants
Element, 
AttributeList, 
ContentModel, 
Parser| Modifier and Type | Field and Description | 
|---|---|
| Element | applet | 
| Element | base | 
| Element | body | 
| Hashtable<String,Element> | elementHash | 
| Vector<Element> | elements | 
| Hashtable<Object,Entity> | entityHash | 
| static int | FILE_VERSION | 
| Element | head | 
| Element | html | 
| Element | isindex | 
| Element | meta | 
| String | name | 
| Element | p | 
| Element | param | 
| Element | pcdata | 
| Element | title | 
ANY, CDATA, CONREF, CURRENT, DEFAULT, EMPTY, ENDTAG, ENTITIES, ENTITY, FIXED, GENERAL, ID, IDREF, IDREFS, IMPLIED, MD, MODEL, MS, NAME, NAMES, NMTOKEN, NMTOKENS, NOTATION, NUMBER, NUMBERS, NUTOKEN, NUTOKENS, PARAMETER, PI, PUBLIC, RCDATA, REQUIRED, SDATA, STARTTAG, SYSTEM| Modifier | Constructor and Description | 
|---|---|
| protected  | DTD(String name)Creates a new DTD with the specified name. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected AttributeList | defAttributeList(String name,
                int type,
                int modifier,
                String value,
                String values,
                AttributeList atts)Creates and returns an  AttributeList. | 
| protected ContentModel | defContentModel(int type,
               Object obj,
               ContentModel next)Creates and returns a new content model. | 
| protected Element | defElement(String name,
          int type,
          boolean omitStart,
          boolean omitEnd,
          ContentModel content,
          String[] exclusions,
          String[] inclusions,
          AttributeList atts)Creates and returns an  Element. | 
| Entity | defEntity(String name,
         int type,
         int ch)Creates and returns a character  Entity. | 
| protected Entity | defEntity(String name,
         int type,
         String str)Creates and returns an  Entity. | 
| void | defineAttributes(String name,
                AttributeList atts)Defines attributes for an  Element. | 
| Element | defineElement(String name,
             int type,
             boolean omitStart,
             boolean omitEnd,
             ContentModel content,
             BitSet exclusions,
             BitSet inclusions,
             AttributeList atts)Returns the  Elementwhich matches the
 specified parameters. | 
| Entity | defineEntity(String name,
            int type,
            char[] data)Defines an entity. | 
| static DTD | getDTD(String name)Returns a DTD with the specified  name. | 
| Element | getElement(int index)Gets an element by index. | 
| Element | getElement(String name)Gets an element by name. | 
| Entity | getEntity(int ch)Gets a character entity. | 
| Entity | getEntity(String name)Gets an entity by name. | 
| String | getName()Gets the name of the DTD. | 
| static void | putDTDHash(String name,
          DTD dtd) | 
| void | read(DataInputStream in)Recreates a DTD from an archived format. | 
| String | toString()Returns a string representation of this DTD. | 
public String name
public final Element pcdata
public final Element html
public final Element meta
public final Element base
public final Element isindex
public final Element head
public final Element body
public final Element applet
public final Element param
public final Element p
public final Element title
public static final int FILE_VERSION
protected DTD(String name)
name - the name, as a String of the new DTDpublic String getName()
public Entity getEntity(String name)
Entity corresponding to the
   name Stringpublic Entity getEntity(int ch)
Entity corresponding to the
    ch characterpublic Element getElement(String name)
name - the requested StringElement corresponding to
   name, which may be newly createdpublic Element getElement(int index)
index - the requested indexElement corresponding to
   indexpublic Entity defineEntity(String name, int type, char[] data)
Entity specified
 by name, type, and data
 exists, it is returned; otherwise a new Entity
 is created and is returned.name - the name of the Entity as a Stringtype - the type of the Entitydata - the Entity's dataEntity requested or a new Entity
   if not foundpublic Element defineElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, BitSet exclusions, BitSet inclusions, AttributeList atts)
Element which matches the
 specified parameters.  If one doesn't exist, a new
 one is created and returned.name - the name of the Elementtype - the type of the ElementomitStart - true if start should be omittedomitEnd - true if end should be omittedcontent - the ContentModelatts - the AttributeList specifying the
    ElementElement specifiedpublic void defineAttributes(String name, AttributeList atts)
Element.name - the name of the Elementatts - the AttributeList specifying the
    Elementpublic Entity defEntity(String name, int type, int ch)
Entity.name - the entity's nameEntityprotected Entity defEntity(String name, int type, String str)
Entity.name - the entity's nameEntityprotected Element defElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, String[] exclusions, String[] inclusions, AttributeList atts)
Element.name - the element's nameElementprotected AttributeList defAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts)
AttributeList.name - the attribute list's nameAttributeListprotected ContentModel defContentModel(int type, Object obj, ContentModel next)
type - the type of the new content modelContentModelpublic String toString()
public static DTD getDTD(String name) throws IOException
name.  If
 a DTD with that name doesn't exist, one is created
 and returned.  Any uppercase characters in the name
 are converted to lowercase.name - the name of the DTDnameIOExceptionpublic void read(DataInputStream in) throws IOException
in - the DataInputStream to read fromIOException Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2023, Oracle and/or its affiliates.  All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.