XML in C++
Wednesday, September 30th, 2009 | General
I needed some new XML libraries because most of my experience with these things were based on some internal, proprietary convenience libraries developed in-house at my last place of employment. I thought it would be easy and I’d find some useful and convenient libraries. However, it turns out that while XML is conceptually easy, the general programming conventions for these things are not! In fact, I’d say working with XML and the open source libraries available is a real pain.
In the end I’ve discovered two libraries which I find useful:
- Xerces-C++ which is a part of the Apache project. It’s a fully implemented, validating XML parser which supports DOM, SAX and SAX2 APIs. It’s very good. It’s very big. It does it all.
- If you don’t care about completeness and you just want to get the job done with your XML, then I’d recommend this small, simple, cross-platform, free and fast C++ XML Parser which is basically a header file and an implementation file. It’s quick and easy to use. Initially I was attracted to it because the API was almost exactly the same as the convenience library I’d used in my previous work. However, I didn’t end up using it because it really just cares about getting the job done and extracting or building XML. So other nice things like error codes, etc have been neglected. For example, the inability of the parser to parse a file will result in the parser exit()’ing the entire application. So I couldn’t use this in an end-user product. Otherwise, great for RAD. The author will also re-license the code to you if you need a BSD license.
No comments yet.
