com.japisoft.fastparser
Class Parser

java.lang.Object
  |
  +--com.japisoft.fastparser.Parser
Direct Known Subclasses:
SaxParser

public class Parser
extends java.lang.Object

Main Parser class

Since:
1.0
Author:
(c) 2002-2003 JAPISoft
See Also:
NodeFactory, DocumentBuilder

Field Summary
 int ERROR_STATE
           
 int STATE_COUNT
           
 int STATE_INIT
           
 
Constructor Summary
Parser()
           
 
Method Summary
 void bufferingMode(boolean buffering)
          if true it will bufferize the input stream before parsing. it costs ressource for low memory device and very fast input stream.
protected  java.io.InputStream createBuffer(java.io.InputStream input)
          Store in memory the current input stream, this is called after the setInputStream method
protected  void fireItemFound(int state, java.lang.String item)
           
 Document getDocument()
           
 DocumentBuilder getDocumentBuilder()
           
 NodeFactory getNodeFactory()
           
 boolean hasBufferingMode()
           
 boolean isMandatoryProlog()
           
 boolean isPreserveWhiteSpace()
          Deprecated.  
static void main(java.lang.String[] args)
           
 void parse()
          Parse the current document
 void preserveComment(boolean comment)
          Save XML comment
 void preserveWhiteSpace(boolean ws)
          Deprecated.  
protected  java.io.InputStream readerToInputStream(java.io.Reader r)
          Convertissor from Reader to InputStream
 void setDocumentBuilder(DocumentBuilder db)
          Reset the builder for the document
 void setInputStream(java.io.InputStream input)
          Set the input stream of the document to parse.
 void setMandatoryProlog(boolean prolog)
          Set the prolog mandatory, but default to true
 void setNodeFactory(NodeFactory nf)
          Update the factory for building node
 void setText(java.lang.String text)
          Reset the document to parsed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_STATE

public final int ERROR_STATE
See Also:
Constant Field Values

STATE_COUNT

public final int STATE_COUNT
See Also:
Constant Field Values

STATE_INIT

public final int STATE_INIT
See Also:
Constant Field Values
Constructor Detail

Parser

public Parser()
Method Detail

setNodeFactory

public void setNodeFactory(NodeFactory nf)
Update the factory for building node


getNodeFactory

public NodeFactory getNodeFactory()
Returns:
the factory for building node

setDocumentBuilder

public void setDocumentBuilder(DocumentBuilder db)
Reset the builder for the document


getDocumentBuilder

public DocumentBuilder getDocumentBuilder()
Returns:
the document builder

getDocument

public Document getDocument()
Returns:
the parsed document

preserveComment

public void preserveComment(boolean comment)
Save XML comment


setInputStream

public void setInputStream(java.io.InputStream input)
Set the input stream of the document to parse. This input will be closed automatically.


bufferingMode

public void bufferingMode(boolean buffering)
if true it will bufferize the input stream before parsing. it costs ressource for low memory device and very fast input stream. By default to true


hasBufferingMode

public boolean hasBufferingMode()

setText

public void setText(java.lang.String text)
Reset the document to parsed


setMandatoryProlog

public void setMandatoryProlog(boolean prolog)
Set the prolog mandatory, but default to true


isMandatoryProlog

public boolean isMandatoryProlog()
Returns:
true is the XML prolog is mandatory

preserveWhiteSpace

public void preserveWhiteSpace(boolean ws)
Deprecated.  

Eliminate extra white space between tag. By default to false


isPreserveWhiteSpace

public boolean isPreserveWhiteSpace()
Deprecated.  

Returns:
eliminate extra white space between tag. By default to false

parse

public void parse()
           throws ParseException
Parse the current document

ParseException

fireItemFound

protected void fireItemFound(int state,
                             java.lang.String item)
                      throws ParseException
ParseException

readerToInputStream

protected java.io.InputStream readerToInputStream(java.io.Reader r)
                                           throws java.io.IOException
Convertissor from Reader to InputStream

java.io.IOException

createBuffer

protected java.io.InputStream createBuffer(java.io.InputStream input)
                                    throws java.io.IOException
Store in memory the current input stream, this is called after the setInputStream method

java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
java.lang.Exception