com.wutka.dtd

Class DTDParser

Implemented Interfaces:
EntityExpansion

public class DTDParser
extends Object
implements EntityExpansion

Parses a DTD file and returns a DTD object
Version:
$Revision: 1.19 $ $Date: 2002/10/01 12:48:47 $ 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 DTDItem
parseCP()
protected DTDCardinal
parseCardinality()
protected void
parseChildren(DTDElement element)
protected DTDContainer
parseChoiceSequence()
protected void
parseContentSpec(com.wutka.dtd.Scanner scanner, DTDElement element)
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)

Field Details

defaultLocation

protected Object defaultLocation

dtd

protected DTD dtd

scanner

protected com.wutka.dtd.Scanner scanner

Constructor Details

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

expandEntity

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

expect

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

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

parseAttdef

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

parseAttlist

protected void parseAttlist()
            throws IOException

parseCP

protected DTDItem parseCP()
            throws IOException

parseCardinality

protected DTDCardinal parseCardinality()
            throws IOException

parseChildren

protected void parseChildren(DTDElement element)
            throws IOException

parseChoiceSequence

protected DTDContainer parseChoiceSequence()
            throws IOException

parseContentSpec

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

parseElement

protected void parseElement()
            throws IOException

parseEntity

protected void parseEntity()
            throws IOException

parseEntityDef

protected void parseEntityDef(DTDEntity entity)
            throws IOException

parseEnumeration

protected DTDEnumeration parseEnumeration()
            throws IOException

parseMixed

protected void parseMixed(DTDElement element)
            throws IOException

parseNotation

protected void parseNotation()
            throws IOException

parseNotationList

protected DTDNotationList parseNotationList()
            throws IOException

parseTopLevelElement

protected void parseTopLevelElement()
            throws IOException

removeElements

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

skipUntil

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

Copyright (c) 2001 Mark Wutka.