java.lang.Object
javax.swing.text.html.parser.DTD
- All Implemented Interfaces:
- DTDConstants
The representation of an SGML DTD.  DTD describes a document
 syntax and is used in parsing of HTML documents.  It contains
 a list of elements and their attributes as well as a list of
 entities defined in the DTD.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionfinal ElementThe element corresponding to applet.final ElementThe element corresponding to base.final ElementThe element corresponding to body.The hash table contains the name of element and the corresponding element.The vector of elementsThe hash table contains anObjectand the correspondingEntitystatic final intThe version of a filefinal ElementThe element corresponding to head.final ElementThe element corresponding to html.final ElementThe element corresponding to isindex.final ElementThe element corresponding to meta.the name of the DTDfinal ElementThe element corresponding to p.final ElementThe element corresponding to param.final ElementThe element corresponding to pcdata.final ElementThe element corresponding to title.Fields declared in interface javax.swing.text.html.parser.DTDConstantsANY, 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
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected AttributeListdefAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts) Creates and returns anAttributeListresponding to a new attribute.protected ContentModeldefContentModel(int type, Object obj, ContentModel next) Creates and returns a new content model.protected ElementdefElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, String[] exclusions, String[] inclusions, AttributeList atts) Creates and returns anElement.Creates and returns a characterEntity.protected EntityCreates and returns anEntity.voiddefineAttributes(String name, AttributeList atts) Defines attributes for anElement.defineElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, BitSet exclusions, BitSet inclusions, AttributeList atts) Returns theElementwhich matches the specified parameters.defineEntity(String name, int type, char[] data) Defines an entity.static DTDReturns a DTD with the specifiedname.getElement(int index) Gets an element by index.getElement(String name) Gets an element by name.getEntity(int ch) Gets a character entity.Gets an entity by name.getName()Gets the name of the DTD.static voidputDTDHash(String name, DTD dtd) Put a name and appropriate DTD to hashtable.voidread(DataInputStream in) Recreates a DTD from an archived format.toString()Returns a string representation of this DTD.
- 
Field Details- 
namethe name of the DTD
- 
elements
- 
elementHash
- 
entityHash
- 
pcdataThe element corresponding to pcdata.
- 
htmlThe element corresponding to html.
- 
metaThe element corresponding to meta.
- 
baseThe element corresponding to base.
- 
isindexThe element corresponding to isindex.
- 
headThe element corresponding to head.
- 
bodyThe element corresponding to body.
- 
appletThe element corresponding to applet.
- 
paramThe element corresponding to param.
- 
pThe element corresponding to p.
- 
titleThe element corresponding to title.
- 
FILE_VERSIONpublic static final int FILE_VERSIONThe version of a file- See Also:
 
 
- 
- 
Constructor Details- 
DTDCreates a new DTD with the specified name.- Parameters:
- name- the name, as a- Stringof the new DTD
 
 
- 
- 
Method Details- 
getName
- 
getEntity
- 
getEntityGets a character entity.- Parameters:
- ch- the character
- Returns:
- the Entitycorresponding to thechcharacter
 
- 
getElement
- 
getElementGets an element by index.- Parameters:
- index- the requested index
- Returns:
- the Elementcorresponding toindex
 
- 
defineEntityDefines an entity. If theEntityspecified byname,type, anddataexists, it is returned; otherwise a newEntityis created and is returned.- Parameters:
- name- the name of the- Entityas a- String
- type- the type of the- Entity
- data- the- Entity's data
- Returns:
- the Entityrequested or a newEntityif not found
 
- 
defineElementpublic Element defineElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, BitSet exclusions, BitSet inclusions, AttributeList atts) Returns theElementwhich matches the specified parameters. If one doesn't exist, a new one is created and returned.- Parameters:
- name- the name of the- Element
- type- the type of the- Element
- omitStart-- trueif start should be omitted
- omitEnd-- trueif end should be omitted
- content- the- ContentModel
- exclusions- the set of elements that must not occur inside the element
- inclusions- the set of elements that can occur inside the element
- atts- the- AttributeListspecifying the- Element
- Returns:
- the Elementspecified
 
- 
defineAttributesDefines attributes for anElement.- Parameters:
- name- the name of the- Element
- atts- the- AttributeListspecifying the- Element
 
- 
defEntity
- 
defEntity
- 
defElementprotected Element defElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, String[] exclusions, String[] inclusions, AttributeList atts) Creates and returns anElement.- Parameters:
- name- the element's name
- type- the element's type
- omitStart-- trueif the element needs no starting tag
- omitEnd-- trueif the element needs no closing tag
- content- the element's content
- exclusions- the elements that must be excluded from the content of the element
- inclusions- the elements that can be included as the content of the element
- atts- the attributes of the element
- Returns:
- the new Element
 
- 
defAttributeListprotected AttributeList defAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts) Creates and returns anAttributeListresponding to a new attribute.- Parameters:
- name- the attribute's name
- type- the attribute's type
- modifier- the attribute's modifier
- value- the default value of the attribute
- values- 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 list
- Returns:
- the new AttributeList
 
- 
defContentModelCreates and returns a new content model.- Parameters:
- type- the type of the new content model
- obj- the content of the content model
- next- pointer to the next content model
- Returns:
- the new ContentModel
 
- 
toString
- 
putDTDHash
- 
getDTDReturns a DTD with the specifiedname. If a DTD with that name doesn't exist, one is created and returned. Any uppercase characters in the name are converted to lowercase.- Parameters:
- name- the name of the DTD
- Returns:
- the DTD which corresponds to name
- Throws:
- IOException- if an I/O error occurs
 
- 
readRecreates a DTD from an archived format.- Parameters:
- in- the- DataInputStreamto read from
- Throws:
- IOException- if an I/O error occurs
 
 
-