DTDConstants
public class DTD extends Object implements DTDConstants
Modifier and Type | Field | Description |
---|---|---|
final Element |
applet |
The element corresponding to applet. |
final Element |
base |
The element corresponding to base. |
final Element |
body |
The element corresponding to body. |
Hashtable |
elementHash |
The hash table contains the name of element and the corresponding element. |
Vector |
elements |
The vector of elements |
Hashtable |
entityHash |
The hash table contains an Object and the corresponding Entity
|
static final int |
FILE_VERSION |
The version of a file |
final Element |
head |
The element corresponding to head. |
final Element |
html |
The element corresponding to html. |
final Element |
isindex |
The element corresponding to isindex. |
final Element |
meta |
The element corresponding to meta. |
String |
name |
the name of the DTD |
final Element |
p |
The element corresponding to p. |
final Element |
param |
The element corresponding to param. |
final Element |
pcdata |
The element corresponding to pcdata. |
final Element |
title |
The element corresponding to 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 | Description |
---|---|---|
protected |
Creates a new DTD with the specified name. |
Modifier and Type | Method | Description |
---|---|---|
protected AttributeList |
defAttributeList |
Creates and returns an AttributeList responding to a new attribute. |
protected ContentModel |
defContentModel |
Creates and returns a new content model. |
protected Element |
defElement |
Creates and returns an Element . |
Entity |
defEntity |
Creates and returns a character Entity . |
protected Entity |
defEntity |
Creates and returns an Entity . |
void |
defineAttributes |
Defines attributes for an Element . |
Element |
defineElement |
Returns the Element which matches the specified parameters. |
Entity |
defineEntity |
Defines an entity. |
static DTD |
getDTD |
Returns a DTD with the specified name . |
Element |
getElement |
Gets an element by index. |
Element |
getElement |
Gets an element by name. |
Entity |
getEntity |
Gets a character entity. |
Entity |
getEntity |
Gets an entity by name. |
String |
getName() |
Gets the name of the DTD. |
static void |
putDTDHash |
Put a name and appropriate DTD to hashtable. |
void |
read |
Recreates a DTD from an archived format. |
String |
toString() |
Returns a string representation of this DTD. |
public String name
public Vector<Element> elements
public Hashtable<String,Element> elementHash
public Hashtable<Object,Entity> entityHash
Object
and the corresponding Entity
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)
name
- the entity nameEntity
corresponding to the name
String
public Entity getEntity(int ch)
ch
- the characterEntity
corresponding to the ch
characterpublic Element getElement(String name)
name
- the requested String
Element
corresponding to name
, which may be newly createdpublic Element getElement(int index)
index
- the requested indexElement
corresponding to index
public 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 String
type
- the type of the Entity
data
- 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 Element
type
- the type of the Element
omitStart
- true
if start should be omittedomitEnd
- true
if end should be omittedcontent
- the ContentModel
exclusions
- the set of elements that must not occur inside the elementinclusions
- the set of elements that can occur inside the elementatts
- the AttributeList
specifying the Element
Element
specifiedpublic void defineAttributes(String name, AttributeList atts)
Element
.name
- the name of the Element
atts
- the AttributeList
specifying the Element
public Entity defEntity(String name, int type, int ch)
Entity
.name
- the entity's nametype
- the entity's typech
- the entity's value (character)Entity
protected Entity defEntity(String name, int type, String str)
Entity
.name
- the entity's nametype
- the entity's typestr
- the entity's data sectionEntity
protected Element defElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, String[] exclusions, String[] inclusions, AttributeList atts)
Element
.name
- the element's nametype
- the element's typeomitStart
- true
if the element needs no starting tagomitEnd
- true
if the element needs no closing tagcontent
- the element's contentexclusions
- the elements that must be excluded from the content of the elementinclusions
- the elements that can be included as the content of the elementatts
- the attributes of the elementElement
protected AttributeList defAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts)
AttributeList
responding to a new attribute.name
- the attribute's nametype
- the attribute's typemodifier
- the attribute's modifiervalue
- the default value of the attributevalues
- the allowed values for the attribute (multiple values could be separated by '|')atts
- the previous attribute of the element; to be placed to AttributeList.next
, creating a linked listAttributeList
protected ContentModel defContentModel(int type, Object obj, ContentModel next)
type
- the type of the new content modelobj
- the content of the content modelnext
- pointer to the next content modelContentModel
public String toString()
public static void putDTDHash(String name, DTD dtd)
name
- the name of the DTDdtd
- the DTDpublic 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 DTDname
IOException
- if an I/O error occurspublic void read(DataInputStream in) throws IOException
in
- the DataInputStream
to read fromIOException
- if an I/O error occurs
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/text/html/parser/DTD.html