Saving a IXMLDOMDocument without end tag
问题 Using MSXML via C++, when I call IXMLDOMDocument::save , empty XML elements will get an end tag, like this: <root> <child name="first"> </child> </root> But I want it saved as this: <root> <child name="first" /> </root> What do I need to do to accomplish that? 回答1: DOM itself does that if there are no child nodes but I don't know why in your case it is doing like this. If you want to do explicitly call Pretty Print on the DOM pointer. #include <msxml2.h> bool FormatDOMDocument