You should check the result of load_file
.
Here's what's going on here:
- XML tag names can't start with digits. This is defined by XML standard.
- pugixml performs this check while loading the document - so
load_file()
fails, producing an empty document - pugixml does not perform this check while appending nodes or saving document, so it is possible to save an invalid document