|
TinyLine 2.5 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
public interface XMLParser
The interface for parsing XML documents using callbacks.
The interface is assumed to be synchronous: the methods must not return until parsing is complete, and an application must wait for an callback to return before futher calls.
Before the parsing you need:
Here:
1) XMLParser scanner
2) InputStream is
3) this implements XMLHandler
Code:
try
{
// Reset and clean up the scanner state
scanner.init();
// Set the input stream
scanner.setInputStream(is);
// Set the callback API
scanner.setXMLHandler(this);
// Now scan all the input till the end of the document or error
for(;;)
{
scanner.getNext();
if(scanner.getError() != XMLParser.XML_ERR_OK) break;
if(scanner.getType() == XMLParser.XML_END_DOCUMENT) break;
}
}
catch (Exception e)
{
return;
}
| Field Summary | |
|---|---|
static int |
XML_COMMENT
XML comment lexical unit type |
static int |
XML_DOCTYPE
XML document type lexical unit type |
static int |
XML_END_DOCUMENT
XML document end lexical unit type |
static int |
XML_END_TAG
XML element end lexical unit type |
static int |
XML_ERR_CDATA
Error: Error in XML char data |
static int |
XML_ERR_CHAR_ATTR
Error: Error in XML character |
static int |
XML_ERR_COMMENT
Error: Error in XML comment |
static int |
XML_ERR_ELEM_TERM
Error: Error in XML element name termination |
static int |
XML_ERR_END_TAG
Error: Error in XML element end |
static int |
XML_ERR_EQU
Error: Error in XML equation character |
static int |
XML_ERR_IO_EXCEPTION
Error: I/O exception error |
static int |
XML_ERR_NAME
Error: Error in XML element name |
static int |
XML_ERR_OK
Error: No errors |
static int |
XML_ERR_UNEXPECTED_EOF
Error: Unexpected end of the input stream |
static int |
XML_ERR_UNSUPPORTED_ENCODING
Error: Unsupported encoding |
static int |
XML_PROCESSING_INSTRUCTION
XML processing instruction lexical unit type |
static int |
XML_START_DOCUMENT
XML document start lexical unit type |
static int |
XML_START_TAG
XML element start lexical unit type |
static int |
XML_TEXT
XML text lexical unit type |
static int |
XML_WHITESPACE
XML white space lexical unit type |
| Method Summary | |
|---|---|
int |
getError()
Returns the current error status. |
void |
getNext()
Processes to the next XML lexical unit. |
int |
getType()
Returns the current XML lexical unit type. |
void |
init()
Resets the internal state for this XMLParser object. |
void |
setInputStream(java.io.InputStream imputstream)
Sets the imput stream for this XMLParser object. |
void |
setXMLHandler(XMLHandler xmlhandler)
Sets the XML callback for this XMLParser object. |
| Field Detail |
|---|
static final int XML_COMMENT
static final int XML_DOCTYPE
static final int XML_END_DOCUMENT
static final int XML_END_TAG
static final int XML_ERR_CDATA
static final int XML_ERR_CHAR_ATTR
static final int XML_ERR_COMMENT
static final int XML_ERR_ELEM_TERM
static final int XML_ERR_END_TAG
static final int XML_ERR_EQU
static final int XML_ERR_IO_EXCEPTION
static final int XML_ERR_NAME
static final int XML_ERR_OK
static final int XML_ERR_UNEXPECTED_EOF
static final int XML_ERR_UNSUPPORTED_ENCODING
static final int XML_PROCESSING_INSTRUCTION
static final int XML_START_DOCUMENT
static final int XML_START_TAG
static final int XML_TEXT
static final int XML_WHITESPACE
| Method Detail |
|---|
int getError()
void getNext()
int getType()
void init()
void setInputStream(java.io.InputStream imputstream)
imputstream - The imput stream.void setXMLHandler(XMLHandler xmlhandler)
xmlhandler - The XML callback.
|
TinyLine 2.5 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||