This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing.text.html.parser
class DTD

java.lang.Object extended by javax.swing.text.html.parser.DTD
All Implemented Interfaces:
DTDConstants

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
DTD(String name)

          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
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

          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
getDTD(String name)

          Returns a DTD with the specified name.
 Element
getElement(int index)

          Gets an element by index.
 Element

          Gets an element by name.
 Entity
getEntity(int ch)

          Gets a character entity.
 Entity

          Gets an entity by name.
 String

          Gets the name of the DTD.
static void
putDTDHash(String name, DTD dtd)

          
 void

          Recreates a DTD from an archived format.
 String

          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

applet

public final Element applet

base

public final Element base

body

public final Element body

elementHash

public Hashtable elementHash

elements

public Vector elements

entityHash

public Hashtable entityHash

FILE_VERSION

public static final int FILE_VERSION

head

public final Element head

html

public final Element html

isindex

public final Element isindex

meta

public final Element meta

name

public String name

p

public final Element p

param

public final Element param

pcdata

public final Element pcdata

title

public final Element title
Constructor Detail

DTD

protected DTD(String name)
Creates a new DTD with the specified name.

Parameters:
name - the name, as a String of the new DTD
Method Detail

defAttributeList

protected AttributeList defAttributeList(String name,
                                         int type,
                                         int modifier,
                                         String value,
                                         String values,
                                         AttributeList atts)
Creates and returns an AttributeList.

Parameters:
name - the attribute list's name
type
modifier
value
values
atts
Returns:
the new AttributeList

defContentModel

protected ContentModel defContentModel(int type,
                                       Object obj,
                                       ContentModel next)
Creates and returns a new content model.

Parameters:
type - the type of the new content model
obj
next
Returns:
the new ContentModel

defElement

protected Element defElement(String name,
                             int type,
                             boolean omitStart,
                             boolean omitEnd,
                             ContentModel content,
                             String[] exclusions,
                             String[] inclusions,
                             AttributeList atts)
Creates and returns an Element.

Parameters:
name - the element's name
type
omitStart
omitEnd
content
exclusions
inclusions
atts
Returns:
the new Element

defEntity

public Entity defEntity(String name,
                        int type,
                        int ch)
Creates and returns a character Entity.

Parameters:
name - the entity's name
type
ch
Returns:
the new character Entity

defEntity

protected Entity defEntity(String name,
                           int type,
                           String str)
Creates and returns an Entity.

Parameters:
name - the entity's name
type
str
Returns:
the new Entity

defineAttributes

public void defineAttributes(String name,
                             AttributeList atts)
Defines attributes for an {@code Element}.

Parameters:
name - the name of the Element
atts - the AttributeList specifying the Element

defineElement

public 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. 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 - true if start should be omitted
omitEnd - true if end should be omitted
content - the ContentModel
exclusions
inclusions
atts - the AttributeList specifying the Element
Returns:
the Element specified

defineEntity

public Entity defineEntity(String name,
                           int type,
                           char[] data)
Defines an entity. If the Entity specified by name, type, and data exists, it is returned; otherwise a new Entity is created and is returned.

Parameters:
name - the name of the Entity as a String
type - the type of the Entity
data - the Entity's data
Returns:
the Entity requested or a new Entity if not found

getDTD

public static DTD getDTD(String name)
                  throws IOException
Returns a DTD with the specified 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.

Parameters:
name - the name of the DTD
Returns:
the DTD which corresponds to name
Throws:
IOException

getElement

public Element getElement(int index)
Gets an element by index.

Parameters:
index - the requested index
Returns:
the Element corresponding to index

getElement

public Element getElement(String name)
Gets an element by name. A new element is created if the element doesn't exist.

Parameters:
name - the requested String
Returns:
the Element corresponding to name, which may be newly created

getEntity

public Entity getEntity(int ch)
Gets a character entity.

Parameters:
ch
Returns:
the Entity corresponding to the ch character

getEntity

public Entity getEntity(String name)
Gets an entity by name.

Parameters:
name
Returns:
the Entity corresponding to the name String

getName

public String getName()
Gets the name of the DTD.

Returns:
the name of the DTD

putDTDHash

public static void putDTDHash(String name,
                              DTD dtd)
Parameters:
name
dtd

read

public void read(DataInputStream in)
          throws IOException
Recreates a DTD from an archived format.

Parameters:
in - the DataInputStream to read from
Throws:
IOException

toString

public String toString()
Returns a string representation of this DTD.

Overrides:
toString in class Object
Returns:
the string representation of this DTD


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.