edu.ucsb.adl.reports
Class XmlDtd

java.lang.Object
  |
  +--edu.ucsb.adl.reports.XmlDtd
Direct Known Subclasses:
AccessReportDtd, BrowseReportDtd, BucketReportDtd, QueryDtd

public abstract class XmlDtd
extends java.lang.Object

Represents an XML DTD. Specifically, an instance of (a concrete subclass of) this abstract class contains the tables and other information needed by the high-performance validating XML parser to parse documents with respect to a given DTD.

Version:
$Header: /export/home/gjanee/utils/reports/edu/ucsb/adl/reports/RCS/XmlDtd.java,v 1.1 2003/03/17 13:43:40 gjanee Exp $

$Log: XmlDtd.java,v $ Revision 1.1 2003/03/17 13:43:40 gjanee Initial revision

Author:
Greg Janée
Alexandria Digital Library

Nested Class Summary
static class XmlDtd.Attribute
          Represents an attribute.
static class XmlDtd.Element
          Represents an element.
 
Field Summary
 java.util.Hashtable elementNameCodeMapping
          Maps element names (e.g., "foo") to element codes (e.g., Integer(27)).
 XmlDtd.Element[] elements
          The DTD's elements, indexed by element code.
 boolean[] finalStates
          Indicates which states in stateTable are final (i.e., accepting) states for the corresponding elements.
 byte[][] stateTable
          The processing states and transitions for the element content models.
 
Constructor Summary
XmlDtd(XmlDtd.Element[] elements, java.util.Hashtable elementNameCodeMapping, byte[][] stateTable, boolean[] finalStates)
          Creates an XmlDtd.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elements

public final XmlDtd.Element[] elements
The DTD's elements, indexed by element code.


elementNameCodeMapping

public final java.util.Hashtable elementNameCodeMapping
Maps element names (e.g., "foo") to element codes (e.g., Integer(27)).


stateTable

public final byte[][] stateTable
The processing states and transitions for the element content models. The table is indexed by state S and element code E; entry [S][E] indicates the state to transition to (specified as a relative offset from S) when element E is encountered in state S. A value of -128 indicates a disallowed transition. The initial state for each element is given in the elements array, above; finalStates, below, indicates which states are accepting states.

In practice, some conventions are followed. The states required to process a given element's content model are grouped together. The content model for the document as a whole is located first in the table and consists of two states. State 0 has a transition to state 1 on the DTD's root element, and is not an accepting state; state 1 has no transitions and is an accepting state.


finalStates

public final boolean[] finalStates
Indicates which states in stateTable are final (i.e., accepting) states for the corresponding elements. Indexed by state.

Constructor Detail

XmlDtd

public XmlDtd(XmlDtd.Element[] elements,
              java.util.Hashtable elementNameCodeMapping,
              byte[][] stateTable,
              boolean[] finalStates)
Creates an XmlDtd. No error checking is performed on the arguments.

Parameters:
elements - The element array.
elementNameCodeMapping - The element name-to-code mapping.
stateTable - The parsing state/transition table.
finalStates - The final states array.