Search code examples
xmlserializationboost

remove versioning on boost xml serialization


i just can't find a way to remove the version tracking from the boost xmlarchives.

example

    <Settings class_id="0" tracking_level="0" version="1">
     <px class_id="1" tracking_level="1" version="0" object_id="_0">
      <TestInt>3</TestInt>
      <Resolution class_id="2" tracking_level="0" version="0">
       <x>800</x>
       <y>600</y>
      </Resolution>
      <SomeStuff>0</SomeStuff>
     </px>
    </Settings>

I want to get ride of the class_id="0" tracking_level="0" version="1" stuff, because for in this case i just don't need it and want a simple clean config like file

code

void serialize(Archive & ar, const unsigned int version)
{
  ar & make_nvp("TestInt", TestInt);

  ar & make_nvp("Resolution", resolution);
  ar & make_nvp("SomeStuff", SomeStuff);
}

i found boost::serialization::track_never, but nowhere to use it


Solution

  • try to create iarchive with "no_header" option:

    boost::archive::xml_iarchive ia(is, boost::archive::no_header);