# About kXML

kXML is a small XML pull parser, specially designed for constrained environments such as Applets, Personal Java or MIDP devices. In contrast to kXML 1, kXML 2 is based on the common XML pull API.

Pull based XML parsing combines some of the advantages of SAX and DOM:

- In contrast to push parsers (SAX), pull parsers such as kXML make it possible to model the XML processing routines after the structure of the processed XML document. Events processing is similar to an InputStream. If a part of the stream requires special handling, the parser can simply be delegated to a specialized method by handing over the parser.
- While the above is also possible with an explicit DOM, DOM usually requires that the whole document structure is present in main memory.
- In contrast to DOM based parsing, the XML events are accessible immediately when they are available, it is not necessary to wait for the whole tree to build up.

## kXML History and Versions

XP | XP was the predecessor of kXML, a simple wrapper that turned a given SAX parser into a pull parser. XP was originally implemented to simplify message (de)serialization in the Infolayer project, which is quite cumbersome with push parsers (SAX).
kXML1 | To use the pull parser on embedded devices, it was necessary to get rid of the SAX dependency. kXML1 is a simple pull parser, based on event objects. kXML1 is now deprecated, please use kXML2 instead. kXML1 is archieved at kxml.objectweb.org.
kXML2 | The current version of kXML. In contrast to kXML1, it features cursor API instead of event objects, leading to a reduced footprint and less object creation overhead. kXML 2 is released under the BSD license.
kXML3 | kXML 3 will split the parser and API support available in versions for both, XmlPull and StAX

## Special Features

kXML has two "special" features that are intended to simplify developers' life in constrained environments:

- Support for WBXML (WAP binary encoded XML): Allows to parse WAP or Wireless Village content
- A robust "relaxed" mode for parsing HTML or SGML files (that are not well-formed XML documents) in order to avoid the need of two separate parsers in mobile phones.

## XML Conformance

In order to keep kXML as small as possible, no efforts are made to recognize certain well-formedness errors that would require additional detection code, such as

- ']]>' contained in text content,
- duplicate attributes, and
- <? folowed by a space before the target.

Thus, kXML will accept some XML documents that should actually be rejected. Of course, an XML parser should detect all syntax errors to discourage the creation of bogous documents that work with one parser and do not work with another. Thus, if you are not limited by memory constraints, please use MXP, which is also faster than kXML.

(C) 1999-2005 Stefan Haustein