Package tigase.xml
Class SimpleParser
java.lang.Object
tigase.xml.SimpleParser
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: - Start element event (with all attributes found).
- End element even.
- Character data event.
- 'OtherXML' data event - everything between '<' and '>' if after < is '?' or '!'. So it can 'catch' doctype declaration, processing instructions but it can't process correctly commented blocks.
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
- Version:
- $Rev$
- Author:
- Artur Hefczyc
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enum
protected static class
protected static enum
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkIsCharValidInXML
(SimpleParser.ParserState parserState, char chr) final void
parse
(SimpleHandler handler, char[] data, int off, int len) final void
parse
(SimpleHandler handler, String input)
-
Field Details
-
ATTRIBUTES_NUMBER_LIMIT_PROP_KEY
- See Also:
-
MAX_ATTRIBS_NUMBER_PROP_KEY
- See Also:
-
MAX_ELEMENT_NAME_SIZE_PROP_KEY
- See Also:
-
MAX_ATTRIBUTE_NAME_SIZE_PROP_KEY
- See Also:
-
MAX_ATTRIBUTE_VALUE_SIZE_PROP_KEY
- See Also:
-
MAX_CDATA_SIZE_PROP_KEY
- See Also:
-
ATTRIBUTES_NUMBER_LIMIT
public int ATTRIBUTES_NUMBER_LIMIT -
MAX_ATTRIBS_NUMBER
public int MAX_ATTRIBS_NUMBERVariable constantMAX_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. -
MAX_ATTRIBUTE_NAME_SIZE
public int MAX_ATTRIBUTE_NAME_SIZE -
MAX_ATTRIBUTE_VALUE_SIZE
public int MAX_ATTRIBUTE_VALUE_SIZE -
MAX_CDATA_SIZE
public int MAX_CDATA_SIZE -
MAX_ELEMENT_NAME_SIZE
public int MAX_ELEMENT_NAME_SIZE
-
-
Constructor Details
-
SimpleParser
public SimpleParser()
-
-
Method Details
-
parse
-
parse
@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) -
checkIsCharValidInXML
-