TinyLine 2.5

com.tinyline.svg
Interface XMLParser


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: Example:
 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;
   }
 

Version:
1.9

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

XML_COMMENT

static final int XML_COMMENT
XML comment lexical unit type

See Also:
Constant Field Values

XML_DOCTYPE

static final int XML_DOCTYPE
XML document type lexical unit type

See Also:
Constant Field Values

XML_END_DOCUMENT

static final int XML_END_DOCUMENT
XML document end lexical unit type

See Also:
Constant Field Values

XML_END_TAG

static final int XML_END_TAG
XML element end lexical unit type

See Also:
Constant Field Values

XML_ERR_CDATA

static final int XML_ERR_CDATA
Error: Error in XML char data

See Also:
Constant Field Values

XML_ERR_CHAR_ATTR

static final int XML_ERR_CHAR_ATTR
Error: Error in XML character

See Also:
Constant Field Values

XML_ERR_COMMENT

static final int XML_ERR_COMMENT
Error: Error in XML comment

See Also:
Constant Field Values

XML_ERR_ELEM_TERM

static final int XML_ERR_ELEM_TERM
Error: Error in XML element name termination

See Also:
Constant Field Values

XML_ERR_END_TAG

static final int XML_ERR_END_TAG
Error: Error in XML element end

See Also:
Constant Field Values

XML_ERR_EQU

static final int XML_ERR_EQU
Error: Error in XML equation character

See Also:
Constant Field Values

XML_ERR_IO_EXCEPTION

static final int XML_ERR_IO_EXCEPTION
Error: I/O exception error

See Also:
Constant Field Values

XML_ERR_NAME

static final int XML_ERR_NAME
Error: Error in XML element name

See Also:
Constant Field Values

XML_ERR_OK

static final int XML_ERR_OK
Error: No errors

See Also:
Constant Field Values

XML_ERR_UNEXPECTED_EOF

static final int XML_ERR_UNEXPECTED_EOF
Error: Unexpected end of the input stream

See Also:
Constant Field Values

XML_ERR_UNSUPPORTED_ENCODING

static final int XML_ERR_UNSUPPORTED_ENCODING
Error: Unsupported encoding

See Also:
Constant Field Values

XML_PROCESSING_INSTRUCTION

static final int XML_PROCESSING_INSTRUCTION
XML processing instruction lexical unit type

See Also:
Constant Field Values

XML_START_DOCUMENT

static final int XML_START_DOCUMENT
XML document start lexical unit type

See Also:
Constant Field Values

XML_START_TAG

static final int XML_START_TAG
XML element start lexical unit type

See Also:
Constant Field Values

XML_TEXT

static final int XML_TEXT
XML text lexical unit type

See Also:
Constant Field Values

XML_WHITESPACE

static final int XML_WHITESPACE
XML white space lexical unit type

See Also:
Constant Field Values
Method Detail

getError

int getError()
Returns the current error status. The value must be one of the following types:


getNext

void getNext()
Processes to the next XML lexical unit. The type of the current lexical unit can be accessed thru getType().


getType

int getType()
Returns the current XML lexical unit type. The value must be one of the following types:


init

void init()
Resets the internal state for this XMLParser object.


setInputStream

void setInputStream(java.io.InputStream imputstream)
Sets the imput stream for this XMLParser object.

Parameters:
imputstream - The imput stream.

setXMLHandler

void setXMLHandler(XMLHandler xmlhandler)
Sets the XML callback for this XMLParser object.

Parameters:
xmlhandler - The XML callback.

TinyLine 2.5

Provided under the terms of the TinyLine License Agreement that has been included with this distribution.