net.socialchange.doctype
Class DoctypeParser

java.lang.Object
  extended by net.socialchange.doctype.DoctypeParser

public class DoctypeParser
extends java.lang.Object

Class for parsing a Doctype declaration and storing read information for later retrieval. Straightforward state machine implementation. If the parse fails for any reason, the parse(InputStream, StringBuffer) method will silently return. You can retrieve an error message through getErrorMessage(). Note: you can get this info through standard SAX and DOM methods. This is a pre-parser so that we can implement conditional replacement of Doctype declaration components.

Version:
$Revision: 1.3 $ $Date: 2001/11/14 11:47:42 $
Author:
Jeff Turner

Field Summary
protected  int debug
          The debugging detail level for this component.
 
Constructor Summary
DoctypeParser()
          Instantiate a parser.
DoctypeParser(int debugLevel)
          Instantiate a parser, with a certain debug level.
 
Method Summary
 Doctype getDoctype()
           
 java.lang.String getErrorMessage()
          If a parse failed, this will return any error message associated with the failure
 void log(int s)
           
 void log(java.lang.String s)
           
 void parse(java.io.InputStream in)
          Parse a doctype declaration.
 void parse(java.io.InputStream in, java.lang.StringBuffer buf)
          Parse a doctype declaration, storing read characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected final int debug
The debugging detail level for this component.

Constructor Detail

DoctypeParser

public DoctypeParser()
Instantiate a parser.


DoctypeParser

public DoctypeParser(int debugLevel)
Instantiate a parser, with a certain debug level.

Method Detail

parse

public void parse(java.io.InputStream in)
           throws java.io.IOException
Parse a doctype declaration. After this call, data may be retrieved with the accessor methods. If the parsed doctype is invalid, this method will silently return.

Parameters:
in - An InputStream where the next character will be somewhere in the text <!Doctype.
Throws:
java.io.IOException
See Also:
getErrorMessage()

parse

public void parse(java.io.InputStream in,
                  java.lang.StringBuffer buf)
           throws java.io.IOException
Parse a doctype declaration, storing read characters. After this call, data may be retrieved with the accessor methods. If the parsed doctype is invalid, this method will silently return.

Parameters:
in - An InputStream where the next character will be somewhere in the text <!Doctype.
buf - The StringBuffer to store read characters to. If null, behave same as parse(InputStream).
Throws:
java.io.IOException
See Also:
getErrorMessage()

getDoctype

public final Doctype getDoctype()

getErrorMessage

public java.lang.String getErrorMessage()
If a parse failed, this will return any error message associated with the failure


log

public void log(java.lang.String s)

log

public void log(int s)


Copyright ? 2001 Social Change Online. All Rights Reserved.