| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public class DTD extends Object implements 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.
Field Summary | |
---|---|
Element |
applet
|
Element |
base
|
Element |
body
|
Hashtable |
elementHash
|
Vector |
elements
|
Hashtable |
entityHash
|
static int |
FILE_VERSION
|
Element |
head
|
Element |
html
|
Element |
isindex
|
Element |
meta
|
String |
name
|
Element |
p
|
Element |
param
|
Element |
pcdata
|
Element |
title
|
Constructor Summary | |
---|---|
protected |
Creates a new DTD with the specified name. |
Method Summary | |
---|---|
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 |
Creates and returns a character Entity .
|
protected Entity |
Creates and returns an Entity .
|
void |
defineAttributes(String name, AttributeList atts) Defines attributes for an . |
Element |
defineElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, BitSet exclusions, BitSet inclusions, AttributeList atts) Returns the Element which matches the
specified parameters.
|
Entity |
defineEntity(String name, int type, char[] data) Defines an entity. |
static DTD |
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 |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final Element applet
public final Element base
public final Element body
public Hashtable elementHash
public Vector elements
public Hashtable entityHash
public static final int FILE_VERSION
public final Element head
public final Element html
public final Element isindex
public final Element meta
public String name
public final Element p
public final Element param
public final Element pcdata
public final Element title
Constructor Detail |
---|
protected DTD(String name)
name
- the name, as a String
of the new DTDMethod Detail |
---|
protected AttributeList defAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts)
AttributeList
.
name
- the attribute list's nametype
modifier
value
values
atts
AttributeList
protected ContentModel defContentModel(int type, Object obj, ContentModel next)
type
- the type of the new content modelobj
next
ContentModel
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
omitStart
omitEnd
content
exclusions
inclusions
atts
Element
public Entity defEntity(String name, int type, int ch)
Entity
.
name
- the entity's nametype
ch
Entity
protected Entity defEntity(String name, int type, String str)
Entity
.
name
- the entity's nametype
str
Entity
public void defineAttributes(String name, AttributeList atts)
name
- the name of the Element
atts
- the AttributeList
specifying the
Element
public 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
inclusions
atts
- the AttributeList
specifying the
Element
Element
specifiedpublic 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 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
public Element getElement(int index)
index
- the requested indexElement
corresponding to
index
public Element getElement(String name)
name
- the requested String
Element
corresponding to
name
, which may be newly createdpublic Entity getEntity(int ch)
ch
Entity
corresponding to the
ch
characterpublic Entity getEntity(String name)
name
Entity
corresponding to the
name
String
public String getName()
public static void putDTDHash(String name, DTD dtd)
name
dtd
public void read(DataInputStream in) throws IOException
in
- the DataInputStream
to read fromIOException
public String toString()
toString
in class Object
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |