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

The XML DTD Parser API

See:
          Description

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.
Token Describes the input token stream.
 

Exception Summary
ParseException This exception is thrown when parse errors are encountered.
 

Error Summary
TokenMgrError This Error is occurs if the Token Manager is unable to form next token and pass it to the parser.
 

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

The XML DTD Parser API

Version:
$Revision: 1.1.1.1 $ $Date: 2003/03/03 07:09:26 $
Author:
Alexander Totok
This package consists of two parsers:

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) - automated tool to generate Java programming language parsers.

Package consists of the following classes and files:

The followinge example parses XML DTD file dtd-document.dtd and constructs 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-2004. All rights reserved http://www.intalio.com