|
|||||||||||
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
If you wish to use this parser in a loop it is suggested to instantiate a new Parser
Note that by default, this parser works in a "buffering mode" which means it will preload all your document before parsing. This step is good for little file < 100 Ko and slow stream. Otherwise you must disable it !
NodeFactory
,
DocumentBuilder
Field Summary | |
static int |
CONTINUE_PARSING_MODE
Continue parsing even with xml error |
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 |
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 |
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 |
isEnabledNameSpace()
|
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. |
void |
setDocumentBuilder(DocumentBuilder db)
Reset the builder for the document |
void |
setEnabledNameSpace(boolean enabled)
|
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 |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
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
public void setEnabledNameSpace(boolean enabled)
enabled
- Enabled for nameSpace (true by default)public boolean isEnabledNameSpace()
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 |