TinyLine
v2.0

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
Author:
Andrew Girow

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_START_DOCUMENT

public static final int XML_START_DOCUMENT
XML document start lexical unit type

See Also:
Constant Field Values

XML_COMMENT

public static final int XML_COMMENT
XML comment lexical unit type

See Also:
Constant Field Values

XML_DOCTYPE

public static final int XML_DOCTYPE
XML document type lexical unit type

See Also:
Constant Field Values

XML_END_DOCUMENT

public static final int XML_END_DOCUMENT
XML document end lexical unit type

See Also:
Constant Field Values

XML_END_TAG

public static final int XML_END_TAG
XML element end lexical unit type

See Also:
Constant Field Values

XML_PROCESSING_INSTRUCTION

public static final int XML_PROCESSING_INSTRUCTION
XML processing instruction lexical unit type

See Also:
Constant Field Values

XML_START_TAG

public static final int XML_START_TAG
XML element start lexical unit type

See Also:
Constant Field Values

XML_TEXT

public static final int XML_TEXT
XML text lexical unit type

See Also:
Constant Field Values

XML_WHITESPACE

public static final int XML_WHITESPACE
XML white space lexical unit type

See Also:
Constant Field Values

XML_ERR_OK

public static final int XML_ERR_OK
Error: No errors

See Also:
Constant Field Values

XML_ERR_IO_EXCEPTION

public static final int XML_ERR_IO_EXCEPTION
Error: I/O exception error

See Also:
Constant Field Values

XML_ERR_UNSUPPORTED_ENCODING

public static final int XML_ERR_UNSUPPORTED_ENCODING
Error: Unsupported encoding

See Also:
Constant Field Values

XML_ERR_COMMENT

public static final int XML_ERR_COMMENT
Error: Error in XML comment

See Also:
Constant Field Values

XML_ERR_UNEXPECTED_EOF

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

See Also:
Constant Field Values

XML_ERR_NAME

public static final int XML_ERR_NAME
Error: Error in XML element name

See Also:
Constant Field Values

XML_ERR_END_TAG

public static final int XML_ERR_END_TAG
Error: Error in XML element end

See Also:
Constant Field Values

XML_ERR_CDATA

public static final int XML_ERR_CDATA
Error: Error in XML char data

See Also:
Constant Field Values

XML_ERR_CHAR_ATTR

public static final int XML_ERR_CHAR_ATTR
Error: Error in XML character

See Also:
Constant Field Values

XML_ERR_ELEM_TERM

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

See Also:
Constant Field Values

XML_ERR_EQU

public static final int XML_ERR_EQU
Error: Error in XML equation character

See Also:
Constant Field Values
Method Detail

setInputStream

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

Parameters:
imputstream - The imput stream.

setXMLHandler

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

Parameters:
xmlhandler - The XML callback.

init

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


getNext

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


getType

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


getError

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


TinyLine
v2.0

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