Package org.exolab.castor.xml.dtd.parser

The XML DTD Parser API
Version:
Author:
Alexander Totok
This package consists of two parsers:

Interface Summary

CharStream This interface describes a character stream that maintains line and column number positions of the characters.
DTDInitialParserConstants
DTDParserConstants

Class Summary

DTDInitialParser Initial XML DTD parser.
DTDInitialParserTokenManager
DTDParser Main XML DTD parser.
DTDParser.JJCalls
DTDParserTokenManager
InputCharStream An implementation of interface CharStream.
ParseException This exception is thrown when parse errors are encountered.
Token Describes the input token stream.
TokenMgrError This Error is occurs if the Token Manager is unable to form next token and pass it to the parser.
The XML DTD Parser API
Version:
Author:
Alexander Totok
This package consists of two parsers: The parser does not parse: The parser does not expand general entity references or character references occurring within attribute and entity values.

The parser is fully compliant with the current XML specification, unless otherwise is stated, for instance it is able to parse Unicode text, provided the java.io.Reader used to instantiate the parser is correctly set up.

The structure of the package:

The parser was written using JavaCC (Java Compiler Compiler) - an automated tool to generate Java programming language parsers.

This package consists of the following classes and files:

The following example parses the XML DTD file dtd-document.dtd and constructs the corresponding XML DTD document object dtd.

FileInputStream inputStream;
InputStreamReader reader;
InputCharStream charStream;
DTDInitialParser initialParser;
String intermedResult;
StringReader strReader;
DTDParser parser;
DTDdocument dtd;
// instantiate input byte stream, associated with the input file
inputStream = new FileInputStream( "dtd-document.dtd" );
// instantiate character reader from the input file byte stream
reader = new InputStreamReader( inputStream, "US-ASCII" );
// instantiate char stream for initial parser from the input reader
charStream = new InputCharStream( reader );
// instantiate initial parser
initialParser = new DTDInitialParser( charStream );
// get result of initial parsing - DTD text document with parameter
// entity references expanded
intermedResult = initialParser.Input();
// construct StringReader from the intermediate parsing result
strReader= new StringReader( intermedResult );
// instantiate char stream for the main parser
charStream = new InputCharStream( strReader );
// instantiate main parser
parser = new DTDParser( charStream );
// parse intermediate parsing result with the main parser
// and get corresponding DTD document oblect
dtd = parser.Input();

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com