Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.hexidec.ekit.component.parser
Class DTD  view DTD download DTD.java

java.lang.Object
  extended bycom.hexidec.ekit.component.parser.DTD
All Implemented Interfaces:
DTDConstants

public class DTD
extends java.lang.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.

Version:
1.14 12/03/01

Field Summary
 Element a
           
 Element applet
           
 Element b
           
 Element base
           
 Element big
           
 Element body
           
 Element br
           
 Element div
           
(package private) static java.util.Hashtable dtdHash
          The hashtable of DTDs.
 java.util.Hashtable elementHash
           
 java.util.Vector elements
           
 java.util.Hashtable entityHash
           
static int FILE_VERSION
           
 Element font
           
 Element h1
           
 Element h2
           
 Element h3
           
 Element h4
           
 Element h5
           
 Element h6
           
 Element head
           
 Element hr
           
 Element html
           
 Element i
           
 Element isindex
           
(package private)  Element link
           
 Element meta
           
 java.lang.String name
           
 Element p
           
 Element param
           
 Element pcdata
           
 Element pre
           
 Element small
           
 Element strike
           
(package private)  Element style
           
 Element sub
           
 Element sup
           
 Element title
           
 Element u
           
 
Fields inherited from interface com.hexidec.ekit.component.parser.DTDConstants
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
 
Constructor Summary
protected DTD(java.lang.String name)
          Creates a new DTD with the specified name.
 
Method Summary
protected  AttributeList defAttributeList(java.lang.String name, int type, int modifier, java.lang.String value, java.lang.String values, AttributeList atts)
          Creates and returns an AttributeList.
protected  ContentModel defContentModel(int type, java.lang.Object obj, ContentModel next)
          Creates and returns a new content model.
protected  Element defElement(java.lang.String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, java.lang.String[] exclusions, java.lang.String[] inclusions, AttributeList atts)
          Creates and returns an Element.
 Entity defEntity(java.lang.String name, int type, int ch)
          Creates and returns a character Entity.
protected  Entity defEntity(java.lang.String name, int type, java.lang.String str)
          Creates and returns an Entity.
 void defineAttributes(java.lang.String name, AttributeList atts)
          Returns the Element which matches the specified AttributeList.
 Element defineElement(java.lang.String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, java.util.BitSet exclusions, java.util.BitSet inclusions, AttributeList atts)
          Returns the Element which matches the specified parameters.
 Entity defineEntity(java.lang.String name, int type, char[] data)
          Defines an entity.
(package private)  boolean elementExists(java.lang.String name)
          Returns true if the element is part of the DTD, otherwise returns false.
static DTD getDTD(java.lang.String name)
          Returns a DTD with the specified name.
 Element getElement(int index)
          Gets an element by index.
 Element getElement(java.lang.String name)
          Gets an element by name.
 Entity getEntity(int ch)
          Gets a character entity.
 Entity getEntity(java.lang.String name)
          Gets an entity by name.
 java.lang.String getName()
          Gets the name of the DTD.
static void putDTDHash(java.lang.String name, DTD dtd)
           
 void read(java.io.DataInputStream in)
          Recreates a DTD from an archived format.
private  AttributeList readAttributeList(java.io.DataInputStream in, java.lang.String[] names)
           
private  ContentModel readContentModel(java.io.DataInputStream in, java.lang.String[] names)
           
private  java.lang.String[] readNameArray(java.io.DataInputStream in, java.lang.String[] names)
           
 java.lang.String toString()
          Returns a string representation of this DTD.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public java.lang.String name

elements

public java.util.Vector elements

elementHash

public java.util.Hashtable elementHash

entityHash

public java.util.Hashtable entityHash

pcdata

public final Element pcdata

html

public final Element html

meta

public final Element meta

base

public final Element base

isindex

public final Element isindex

head

public final Element head

body

public final Element body

applet

public final Element applet

param

public final Element param

p

public final Element p

font

public final Element font

h1

public final Element h1

h2

public final Element h2

h3

public final Element h3

h4

public final Element h4

h5

public final Element h5

h6

public final Element h6

div

public final Element div

br

public final Element br

hr

public final Element hr

u

public final Element u

a

public final Element a

b

public final Element b

i

public final Element i

sup

public final Element sup

sub

public final Element sub

strike

public final Element strike

pre

public final Element pre

big

public final Element big

small

public final Element small

title

public final Element title

style

final Element style

link

final Element link

FILE_VERSION

public static int FILE_VERSION

dtdHash

static java.util.Hashtable dtdHash
The hashtable of DTDs.

Constructor Detail

DTD

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

Method Detail

getName

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


getEntity

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


getEntity

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


elementExists

boolean elementExists(java.lang.String name)
Returns true if the element is part of the DTD, otherwise returns false.


getElement

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


getElement

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


defineEntity

public Entity defineEntity(java.lang.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.


defineElement

public Element defineElement(java.lang.String name,
                             int type,
                             boolean omitStart,
                             boolean omitEnd,
                             ContentModel content,
                             java.util.BitSet exclusions,
                             java.util.BitSet inclusions,
                             AttributeList atts)
Returns the Element which matches the specified parameters. If one doesn't exist, a new one is created and returned.


defineAttributes

public void defineAttributes(java.lang.String name,
                             AttributeList atts)
Returns the Element which matches the specified AttributeList. If one doesn't exist, a new one is created and returned.


defEntity

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


defEntity

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


defElement

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


defAttributeList

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


defContentModel

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


toString

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


putDTDHash

public static void putDTDHash(java.lang.String name,
                              DTD dtd)

getDTD

public static DTD getDTD(java.lang.String name)
                  throws java.io.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.


read

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


readContentModel

private ContentModel readContentModel(java.io.DataInputStream in,
                                      java.lang.String[] names)
                               throws java.io.IOException

readNameArray

private java.lang.String[] readNameArray(java.io.DataInputStream in,
                                         java.lang.String[] names)
                                  throws java.io.IOException

readAttributeList

private AttributeList readAttributeList(java.io.DataInputStream in,
                                        java.lang.String[] names)
                                 throws java.io.IOException