
William Bardon wrote:
Robert,
I forced a crude solution by defining a custom XML output archive and defining My_Archive::save_override(const nvp<T>&, int) as below. This would double the class information in some objects, so I also set the BOOST_CLASS_IMPLEMENTATION to object_serializable for my serialized classes. It is crude, but seems to give me the results I need.
Hmmm - crude but effective. I'm sure some would find that an apt description of the whole serialization library.
By examining the library's source code, I have determined that the tracking of class traits in serialization occurs in basic_oarchive_impl::save_object, defined in basic_oarchive.cpp. It uses the class cobject_type to track classes it has seen. Because basic_archive_impl and cobject_type are completely defined within basic_archive.cpp, the ability to customize XML attributes is limited.
I don't think this is a limitation.
Perhaps future versions of Serialization could look into making the XML optionally generate an XML schema for interoperation with other XML-based applications.
I considered that for a while. I only made the xml_?archive to satisfy those who thought it was necessary for the package to be useful. So I focused on the smallest, simplest, and "crudest" implementation which would pass the bar. I'm sort of amazed that that has been "good enough" so that user's have'nt seen it worthwhile to invest their own efforts to improve it. I see no obstacle on making an xml_[i/o]archive which would optionally dump an xml schema along with the xml data. I'm no xml expert so the details of what would be useful are not known to me. I don't think this would be a huge project for someone who really needs it. Good Luck. Robert Ramey
Thanks, Bill
\