From: Nils Springob (nils.springob_at_[hidden])
Date: 2006-09-07 12:13:13
Perhaps you can get some additional ideas from my xml lib, it's not
finished yet, but it already works. You can download it here:
I am using my library to transmit data over a tcp stream (wrapped in an
std::istream and an std::ostream), load and store measurement data and
for handling configuration data in xml-files.
I wrote a class generator which generates derived xml element nodes. The
generator itself uses the library, and generates it's own source code ;-)
I started developing an xml-library for c++ because the existing
libraries did not fit my taste. I think they are written for other
languages than c++: DOM and SAX are good and nice for java and .net
applications. Libxml is to big, and TinyXml supports only the DOM
When I use xml, I can ensure that everything is coded in UTF-8, so it
would be possible to work with char based std::streams and std::strings,
and if the file would be coded in "real Unicode", there would be the
possibility to use the wchar based classes.
My design of the library has 3 different layers:
The requirements for the fist (tag based) layer were (demo1):
- Compatibility with std::istream and std::ostream
- Extremely lightweight, not a huge xml framework...
The requirements for the second layer were (demo2):
- Access to an element tree, which may contain a whole xml document or
a part of it.
- The parser can load the whole document, or a single element with or
without it's contents.
The requirement for the third layer were (demo3 and xclassgen):
- Access to the elements of the tree by derived classes which can be
automatically generated by an xml:schema definition file.
The current limitations of the library are:
- no encoding support, but UTF-8 can be handled with std::string
- no namespaces, but it should be possible to change this...
- the automatic generation of the derived classes needs at the moment a
special xml definition file, it does not work with the xml:schema file
Loading an xml document is always done by a pull parser based on an
std::istream, pushing will be handled by using a thread wrapped around
the pull parser (so there is no need to use an self made stack....)
xml::node n = xin.getNextNode();
if (n==0) break;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk