I'm trying to use pugixml to modify xml configuration, created through boost::serialization and used by other application so i need to change only few fragments of document and leave all other parts the same.
Some nodes may store empty strings in the form of <value></value>
. After load & save (with pugi) this nodes changes into <value />
. After this boost::serialization cannot parse such file.
Load options parse_ws_pcdata_single
and parse_ws_pcdata
works only if there is white space between.
I didn't found saving option for saving empty nodes in form <value></value>
too.
Is there any way to preserve opening & closing tags with zero text between?
If someone still comes across this question, you don't need to change the source. Simply use this flag when writing your tree:
pugi::format_no_empty_element_tags
See the docs in https://pugixml.org/docs/manual.html#saving.options