|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.japisoft.fastparser.Parser
Main Parser class. This parser works with several modes:
CONTINUE_PARSING_MODE : Ignore parsing error (for odd XML document / HTML document )
LOW_PARSING_MODE : Don't check for closing tag : for well-formed document
MEDIUM_PARSING_MODE : The default mode
HIGH_PARSING_MODE : Not supported in this version
NodeFactory
,
DocumentBuilder
Field Summary | |
static int |
CONTINUE_PARSING_MODE
Continue parsing even with xml error |
int |
ERROR_STATE
|
static int |
HIGH_PARSING_MODE
Validate the document : not available |
static int |
LOW_PARSING_MODE
Don't check for closing node : only for well formed document |
static int |
MEDIUM_PARSING_MODE
Default mode for parsing |
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. |
void |
cdataEnabled(boolean enabled)
Support for CDATA Section : By default this is enabled |
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()
|
int |
getParsingMode()
|
boolean |
hasBufferingMode()
|
void |
interruptParsing()
Interrupt the current parsing, this is useful for asynchronous parsing usage |
boolean |
isCdataEnabled()
|
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 : by default this is disabled |
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 |
setParsingMode(int mode)
Reset the parsing mode: this choice can impact on the parser velocity. |
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 |
public final int ERROR_STATE
public final int STATE_COUNT
public final int STATE_INIT
public static final int CONTINUE_PARSING_MODE
public static final int LOW_PARSING_MODE
public static final int MEDIUM_PARSING_MODE
public static final int HIGH_PARSING_MODE
Constructor Detail |
public Parser()
Method Detail |
public void setNodeFactory(NodeFactory nf)
public NodeFactory getNodeFactory()
public void setDocumentBuilder(DocumentBuilder db)
public DocumentBuilder getDocumentBuilder()
public Document getDocument()
public void cdataEnabled(boolean enabled)
public boolean isCdataEnabled()
public void preserveComment(boolean comment)
public void setInputStream(java.io.InputStream input)
public void bufferingMode(boolean buffering)
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
public boolean hasBufferingMode()
public void setText(java.lang.String text)
public void setMandatoryProlog(boolean prolog)
true
public boolean isMandatoryProlog()
true
is the XML prolog is mandatorypublic void preserveWhiteSpace(boolean ws)
false
public boolean isPreserveWhiteSpace()
false
public void interruptParsing()
public void setParsingMode(int mode)
mode
- CONTINUE_PARSING_MODE
for ignoring xml error, LOW_PARSING_MODE
for
not checking closing tag : always for well formed document, MEDIUM_PARSING_MODE
by default, HIGH_PARSING_MODE
not availablepublic int getParsingMode()
public void parse() throws ParseException
ParseException
protected void fireItemFound(int state, java.lang.String item) throws ParseException
ParseException
protected java.io.InputStream readerToInputStream(java.io.Reader r) throws java.io.IOException
java.io.IOException
protected java.io.InputStream createBuffer(java.io.InputStream input) throws java.io.IOException
setInputStream
method
java.io.IOException
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |