tigase.xml
Class SimpleParser

java.lang.Object
  extended by tigase.xml.SimpleParser

public class SimpleParser
extends java.lang.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:

Although very simple this imlementation is sufficient for Jabber protocol needs and is even used by some other packages of this server like implementation of 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

Field Summary
static int MAX_ATTRIBS_NUMBER
          Variable constant MAX_ATTRIBS_NUMBER keeps value of maximum possible attributes number.
 
Constructor Summary
SimpleParser()
           
 
Method Summary
 void parse(SimpleHandler handler, char[] data, int off, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_ATTRIBS_NUMBER

public static int MAX_ATTRIBS_NUMBER
Variable constant 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.

Constructor Detail

SimpleParser

public SimpleParser()
Method Detail

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)


Copyright © 2001-2006 Tigase Developers Team. All rights Reserved.