superwaba.ext.xplat.util.xml
Class XmlLiteParser
java.lang.Object
|
+--superwaba.ext.xplat.util.xml.LiteParser
|
+--superwaba.ext.xplat.util.xml.XmlLiteParser
- public class XmlLiteParser
- extends LiteParser
This is a fast and simple parser for a lite version of XML format. You can
use this parser with SuperWaba VM to parse data from an open Stream.
The parser looks for:
- start-tag name,
- end-tag name,
- attribute name,
- attribute value,
- content between a start-tag and an end-tag.
When the parser finds these elements it calls respectively:
- foundStartTagName();
- foundEndTagName();
- foundAttributeName();
- foundAttributeValue();
- foundContent();
The parsing algorithm is based on DFA (Deterministic Finite Automata)
theory and Regular Expression theory. See the following schema:
In order to use this parser you need to extend the XmlListener class and
override the above methods. To start parsing, call the method
parse(byte inputBytes, int length).
See also samples/util/xml.
Method Summary |
void |
parse(byte[] input,
int size)
This method parses the given array of bytes.
|
void |
parse(StreamBuffer sbuf)
Parse a Stream Buffer |
protected void |
parseBuffer(byte[] input,
int size)
This method does the actual parsing and call backs working for the
current values of pos, len, start and state. |
listener
protected XmlListener listener
- Listener of this parser
XmlLiteParser
public XmlLiteParser(XmlListener listener)
parse
public void parse(byte[] input,
int size)
throws ParserException
- This method parses the given array of bytes.
The algorithm is based on DFA (Deterministic Finite Automata) theory and
Regular Expression theory.
- Parameters:
input
- The input byte array.size
- The size of bytes to be parsed. Normally should be input.length
parse
public void parse(StreamBuffer sbuf)
throws ParserException
- Parse a Stream Buffer
- Parameters:
sbuff
- A buffer that can be refilled from a stream- Throws:
- ParserException -
parseBuffer
protected void parseBuffer(byte[] input,
int size)
throws ParserException
- This method does the actual parsing and call backs working for the
current values of pos, len, start and state. It is called by
parse(byte[],int) and may be called by derived XmlLiteParsers.
atn
- Parameters:
size
- - Throws:
- ParserException -