|
TinyLine v2.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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 |
public static final int XML_START_DOCUMENT
public static final int XML_COMMENT
public static final int XML_DOCTYPE
public static final int XML_END_DOCUMENT
public static final int XML_END_TAG
public static final int XML_PROCESSING_INSTRUCTION
public static final int XML_START_TAG
public static final int XML_TEXT
public static final int XML_WHITESPACE
public static final int XML_ERR_OK
public static final int XML_ERR_IO_EXCEPTION
public static final int XML_ERR_UNSUPPORTED_ENCODING
public static final int XML_ERR_COMMENT
public static final int XML_ERR_UNEXPECTED_EOF
public static final int XML_ERR_NAME
public static final int XML_ERR_END_TAG
public static final int XML_ERR_CDATA
public static final int XML_ERR_CHAR_ATTR
public static final int XML_ERR_ELEM_TERM
public static final int XML_ERR_EQU
| Method Detail |
public void setInputStream(java.io.InputStream imputstream)
imputstream - The imput stream.public void setXMLHandler(XMLHandler xmlhandler)
xmlhandler - The XML callback.public void init()
public void getNext()
public int getType()
public int getError()
|
TinyLine v2.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||