public class SimpleParser extends Object
SimpleParser
- implementation of SAX parser.
This is very basic implementation of XML parser designed especially
to be light and parse XML streams like jabber XML stream.
It is very efficient, capable of parsing parts of XML document
received from the network connection as well as handling a few XML
documents in one buffer. This is especially useful when parsing data
received from the network. Packets received from the network can contain
non-comlete
XML document as well as a few complete XML documents. It
doesn't support XML comments, processing instructions, document
inclussions. Actually it supports only:
UserRepository
based on XML file or
server configuration.
It is worth to note also that this class is fully thread safe. It means that one instance of this class can be simultanously used by many threads. This is to improve resources usage when processing many client connections at the same time.
Created: Fri Oct 1 23:02:15 2004
Modifier and Type | Class and Description |
---|---|
protected static class |
SimpleParser.EntityType |
protected static class |
SimpleParser.ParserState |
protected static class |
SimpleParser.State |
Modifier and Type | Field and Description |
---|---|
int |
ATTRIBUTES_NUMBER_LIMIT |
static String |
ATTRIBUTES_NUMBER_LIMIT_PROP_KEY |
int |
MAX_ATTRIBS_NUMBER
Variable constant
MAX_ATTRIBS_NUMBER keeps value of
maximum possible attributes number. |
static String |
MAX_ATTRIBS_NUMBER_PROP_KEY |
int |
MAX_ATTRIBUTE_NAME_SIZE |
static String |
MAX_ATTRIBUTE_NAME_SIZE_PROP_KEY |
int |
MAX_ATTRIBUTE_VALUE_SIZE |
static String |
MAX_ATTRIBUTE_VALUE_SIZE_PROP_KEY |
int |
MAX_CDATA_SIZE |
static String |
MAX_CDATA_SIZE_PROP_KEY |
int |
MAX_ELEMENT_NAME_SIZE |
static String |
MAX_ELEMENT_NAME_SIZE_PROP_KEY |
Constructor and Description |
---|
SimpleParser() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkIsCharValidInXML(SimpleParser.ParserState parserState,
char chr) |
void |
parse(SimpleHandler handler,
char[] data,
int off,
int len)
Method description
|
public int ATTRIBUTES_NUMBER_LIMIT
public static final String ATTRIBUTES_NUMBER_LIMIT_PROP_KEY
public int MAX_ATTRIBS_NUMBER
MAX_ATTRIBS_NUMBER
keeps value of
maximum possible attributes number. Real XML parser shouldn't have
such limit but in most cases XML elements don't have too many attributes.
For efficiency it is better to use fixed number of attributes and
operate on arrays than on lists.
Data structures will automaticly grow if real attributes number is
bigger so there should be no problem with processing XML streams
different than expected.public static final String MAX_ATTRIBS_NUMBER_PROP_KEY
public int MAX_ELEMENT_NAME_SIZE
public static final String MAX_ELEMENT_NAME_SIZE_PROP_KEY
public int MAX_ATTRIBUTE_NAME_SIZE
public static final String MAX_ATTRIBUTE_NAME_SIZE_PROP_KEY
public int MAX_ATTRIBUTE_VALUE_SIZE
public static final String MAX_ATTRIBUTE_VALUE_SIZE_PROP_KEY
public int MAX_CDATA_SIZE
public static final String MAX_CDATA_SIZE_PROP_KEY
@TODO(note="1. Better XML errors detection. 2. Add XML comments handling. 3. Character overflow detection i.e. limit max number of characters for each entity.") public final void parse(SimpleHandler handler, char[] data, int off, int len)
handler
- data
- off
- len
- protected boolean checkIsCharValidInXML(SimpleParser.ParserState parserState, char chr)
Copyright © 2019 "Tigase, Inc.". All rights reserved.