com.wutka.dtd
Class DTDParser

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

public class DTDParser
extends Object
implements EntityExpansion

Parses a DTD file and returns a DTD object

Version:
$Revision: 1.13 $ $Date: 2001/07/05 23:47:13 $ by $Author: wutka $
Author:
Mark Wutka

Field Summary
protected  Object defaultLocation
           
protected  DTD dtd
           
protected  com.wutka.dtd.Scanner scanner
           
 
Constructor Summary
DTDParser(File in)
          Creates a parser that will read from the specified File object
DTDParser(File in, boolean trace)
          Creates a parser that will read from the specified File object
DTDParser(Reader in)
          Creates a parser that will read from the specified Reader object
DTDParser(Reader in, boolean trace)
          Creates a parser that will read from the specified Reader object
DTDParser(URL in)
          Creates a parser that will read from the specified URL object
DTDParser(URL in, boolean trace)
          Creates a parser that will read from the specified URL object
 
Method Summary
 DTDEntity expandEntity(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(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

defaultLocation

protected Object defaultLocation
Constructor Detail

DTDParser

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

DTDParser

public DTDParser(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)

DTDParser

public DTDParser(File in)
          throws IOException
Creates a parser that will read from the specified File object

DTDParser

public DTDParser(File in,
                 boolean trace)
          throws IOException
Creates a parser that will read from the specified File object
Parameters:
in - The file to read
trace - True if the parser should print out tokens as it reads them (used for debugging the parser)

DTDParser

public DTDParser(URL in)
          throws IOException
Creates a parser that will read from the specified URL object

DTDParser

public DTDParser(URL in,
                 boolean trace)
          throws IOException
Creates a parser that will read from the specified URL object
Parameters:
in - The URL 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 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 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(Hashtable h,
                              DTD dtd,
                              DTDItem item)

parseTopLevelElement

protected void parseTopLevelElement()
                             throws IOException

skipUntil

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

expect

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

parseElement

protected void parseElement()
                     throws IOException

parseContentSpec

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

parseMixed

protected void parseMixed(DTDElement element)
                   throws IOException

parseChildren

protected void parseChildren(DTDElement element)
                      throws IOException

parseChoiceSequence

protected DTDContainer parseChoiceSequence()
                                    throws IOException

parseCP

protected DTDItem parseCP()
                   throws IOException

parseCardinality

protected DTDCardinal parseCardinality()
                                throws IOException

parseAttlist

protected void parseAttlist()
                     throws IOException

parseAttdef

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

parseNotationList

protected DTDNotationList parseNotationList()
                                     throws IOException

parseEnumeration

protected DTDEnumeration parseEnumeration()
                                   throws IOException

parseEntity

protected void parseEntity()
                    throws IOException

parseEntityDef

protected void parseEntityDef(DTDEntity entity)
                       throws IOException

parseNotation

protected void parseNotation()
                      throws IOException

expandEntity

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