XML Parser for C++

If you want to parse XML files with C++, Xerces-C++ is nice tool to do it. http://xerces.apache.org/xerces-c/

Some things you have to care about:

File encoding:  If not set to the correct file encoding, the parser will produce errors. Use „XMLUni::fgUTF8EncodingString“ for UTF-8 encoded files.

Parsing XML from a string: Create a  MemBufInputSource with options MemBufInputSource((const XMLByte*)myxml.c_str(),myxml.length, „dummystring“, false); Here myxml.length should be the bytes(!) not length of your xml string.

Before you can transcode any UTF-16 given XMLCh*, you have to initialize the tools by adding XMLPlatformUtils::Initialize();

The includes used by Xerces are <stdexcept>,<list>,<sys/types.h>,<sys/stat.h>,<unitstd.h>,<errno.h> and for MemBufInputSource <xercesx/framework/MemBufInputSource.hpp>

You should use „namespace xercesc“.