
From: Nat Goodspeed
- I often embed some comment nodes inside the xml to facilitate the manual edit. E.g, enumeration of accepted value some fields. I wish boost.serialize ignores them when parsing,
That seems plausible to me...
and embed them when saving (is this possible).
This request feels more difficult. Boost.Serialize is designed to read from a file into /your/ data structures, and/or write those data structures to a file. XML is only one of several possible archive formats for such a file.
Where in your own data structures would you recommend the Serialize library store any XML comments it may encounter?
Supposing there were an appropriate place to collect such comments, how
would you write them again in something like their original file location?
Just for the fun of discussion, how about allowing only one comment node only and fixing the position to be the end of the file, like this: First, add an optional parameter to signature. template<class Archive> void serialize(Archive & ar, const unsigned int version, basic_string<Ch> comment = basic_string<Ch>()) Then, toward the end of the file, append this node This does not break the compatibility of the existing version, and that the xml archive version already includes more info(i.e. names in additional to values) than other variants(e.g. bins), it does not actually violate the current philosophy much.
Instead of incrementally enhancing a minimal XML parser, wouldn't it make more sense to jump right to an existing full-blown parser implementation? Ah, while this is too limited, a full-blown is too heavy.