I’m taking a workshop at work taught by David Abrahams, and he briefly mentioned this thing called XSMELL, which apparently allows you to write XML-like things in pure C++ code. From the README:
Congratulations! You have in your hands the MOST BRILLIANTEST C++ XML CREATION LIBRARY EVER CREATED. ... And you no longer have to worry about generating malformed XML! After spending hours fighting obscure C++ compiler errors, you’ll be 100% certain that your XML is correct.