DOM Basics with C++ and MSXML
When I first started working with Visual C++ and the Microsoft XML Core Services (MSXML), I found the going a bit rough. Most of the books and examples that I found seemed to be geared toward using MSXML from Visual Basic. The few C++ examples (including those in the MSXML SDK) were coded in a variety of styles and didn't concisely cover the main things I needed to know to enable a legacy application to produce or consume XML. I'm happy to report that the situation has improved a bit since then. And Visual Studio .NET offers a different Document Object Model (DOM) implementation that turns even MSXML into legacy technology. However, I think that there are probably quite a few C++ developers haven't made the jump to .NET and might benefit from a basic but comprehensive introduction to using MSXML with C++.
In this article, I'll cover the essential things you need to know about how to use the MSXML DOM implementation from C++. We'll start with DOM and MSXML/C++ basics, and then review two very simple programs that consume and produce XML documents. We'll conclude with a brief discussion of more advanced topics.