libstudxml: modern C++ XML API

libstudxml is a streaming XML pull parser and streaming XML serializer implementation for modern, standard C++. It has an API that we believe should have already been in Boost or even in the C++ standard library.

  ifstream ifs (argv[1]);
  parser p (ifs, argv[1]);

  p.next_expect (parser::start_element,
                 "person",
                 content::complex);
  string n = p.element ("name");
  short a = p.element<short> ("age");
  gender g = p.element<gender> ("gender");
  p.next_expect (parser::end_element);


<person>


  <name>John Doe</name>
  <age>23</age>
  <gender>male</gender>
</person>

libstudxml is compact, external dependency-free, and reasonably efficient. XML parser is a conforming, non-validating XML 1.0 implementation that is based on tested and proven code.

"We replaced a rapidxml parser and not only is libstudxml much faster, but the code is so much clearer."
Jeff Garland, author of the Boost Date-Time library
"We're really pleased with libstudxml. Our production use parses a 50Mb xml file in about 3 seconds, which is plenty fast for us."
Glenn Ehrlich
"I have looked at libstudxml for parsing, and it is really the best thing I have seen so far for C++. I am still not really convinced if I am happy without a DOM, but that aside, the approach is really nice!

I've written at least a streaming WikiMedia dump parser with it, and it was really, really simple, and the resulting code is quite short. I much prefer this approach over SAX, which takes a lot longer to actually write."

License

libstudxml is free, open-source software; you can use, distribute, and/or modify it under the terms of the MIT License.

Documentation

Designing XML API for Modern C++ Video of a talk given at C++Now 2014 that introduced libstudxml.
XML Parsing and Serialization in C++
With libstudxml
An introduction to the XML parsing and serialization APIs with examples.
INSTALL Building and installation instructions.

Download

libstudxml is distributed in source code and comes with the standard autotools build system as well as the VC++ project files for VC versions 9-12. For build instructions refer to the accompanying INSTALL file.

libstudxml-1.0.1 zip | sha1 tar.gz | sha1 tar.bz2 | sha1

For previous versions see the libstudxml download directory. The development version is available from the libstudxml repository.

Support

Community support for libstudxml is available via the studxml-users mailing list. Simply send an email to studxml-users@codesynthesis.com with the description of a bug or a problem that you encountered. Please follow the Posting Guidelines to receive a prompt reply.