com.wutka.dtd
Class DTDParser

java.lang.Object
  |
  +--com.wutka.dtd.DTDParser
All Implemented Interfaces:
EntityExpansion

public class DTDParser
extends java.lang.Object
implements EntityExpansion

Parses a DTD file and returns a DTD object


Field Summary
protected  DTD dtd
           
protected  com.wutka.dtd.Scanner scanner
           
 
Constructor Summary
DTDParser(java.io.Reader in)
          Creates a parser that will read from the specified Reader object
DTDParser(java.io.Reader in, boolean trace)
          Creates a parser that will read from the specified Reader object
 
Method Summary
 DTDEntity expandEntity(java.lang.String name)
           
protected  com.wutka.dtd.Token expect(com.wutka.dtd.TokenType expected)
           
 DTD parse()
          Parses the DTD file and returns a DTD object describing the DTD.
 DTD parse(boolean guessRootElement)
          Parses the DTD file and returns a DTD object describing the DTD.
protected  void parseAttdef(com.wutka.dtd.Scanner scanner, DTDElement element, DTDAttlist attlist)
           
protected  void parseAttlist()
           
protected  DTDCardinal parseCardinality()
           
protected  void parseChildren(DTDElement element)
           
protected  DTDContainer parseChoiceSequence()
           
protected  void parseContentSpec(com.wutka.dtd.Scanner scanner, DTDElement element)
           
protected  DTDItem parseCP()
           
protected  void parseElement()
           
protected  void parseEntity()
           
protected  void parseEntityDef(DTDEntity entity)
           
protected  DTDEnumeration parseEnumeration()
           
protected  void parseMixed(DTDElement element)
           
protected  void parseNotation()
           
protected  DTDNotationList parseNotationList()
           
protected  void parseTopLevelElement()
           
protected  void removeElements(java.util.Hashtable h, DTD dtd, DTDItem item)
           
protected  void skipUntil(com.wutka.dtd.TokenType stopToken)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scanner

protected com.wutka.dtd.Scanner scanner

dtd

protected DTD dtd
Constructor Detail

DTDParser

public DTDParser(java.io.Reader in)
Creates a parser that will read from the specified Reader object

DTDParser

public DTDParser(java.io.Reader in,
                 boolean trace)
Creates a parser that will read from the specified Reader object
Parameters:
in - The input stream to read
trace - True if the parser should print out tokens as it reads them (used for debugging the parser)
Method Detail

parse

public DTD parse()
          throws java.io.IOException
Parses the DTD file and returns a DTD object describing the DTD. This invocation of parse does not try to guess the root element (for efficiency reasons)

parse

public DTD parse(boolean guessRootElement)
          throws java.io.IOException
Parses the DTD file and returns a DTD object describing the DTD.
Parameters:
guessRootElement - If true, tells the parser to try to guess the root element of the document by process of elimination

removeElements

protected void removeElements(java.util.Hashtable h,
                              DTD dtd,
                              DTDItem item)

parseTopLevelElement

protected void parseTopLevelElement()
                             throws java.io.IOException

skipUntil

protected void skipUntil(com.wutka.dtd.TokenType stopToken)
                  throws java.io.IOException

expect

protected com.wutka.dtd.Token expect(com.wutka.dtd.TokenType expected)
                              throws java.io.IOException

parseElement

protected void parseElement()
                     throws java.io.IOException

parseContentSpec

protected void parseContentSpec(com.wutka.dtd.Scanner scanner,
                                DTDElement element)
                         throws java.io.IOException

parseMixed

protected void parseMixed(DTDElement element)
                   throws java.io.IOException

parseChildren

protected void parseChildren(DTDElement element)
                      throws java.io.IOException

parseChoiceSequence

protected DTDContainer parseChoiceSequence()
                                    throws java.io.IOException

parseCP

protected DTDItem parseCP()
                   throws java.io.IOException

parseCardinality

protected DTDCardinal parseCardinality()
                                throws java.io.IOException

parseAttlist

protected void parseAttlist()
                     throws java.io.IOException

parseAttdef

protected void parseAttdef(com.wutka.dtd.Scanner scanner,
                           DTDElement element,
                           DTDAttlist attlist)
                    throws java.io.IOException

parseNotationList

protected DTDNotationList parseNotationList()
                                     throws java.io.IOException

parseEnumeration

protected DTDEnumeration parseEnumeration()
                                   throws java.io.IOException

parseEntity

protected void parseEntity()
                    throws java.io.IOException

parseEntityDef

protected void parseEntityDef(DTDEntity entity)
                       throws java.io.IOException

parseNotation

protected void parseNotation()
                      throws java.io.IOException

expandEntity

public DTDEntity expandEntity(java.lang.String name)
Specified by:
expandEntity in interface EntityExpansion