C++: XML validation, writing and wrapper cleanup