Boost logo

Boost Users :

Subject: [Boost-users] Editable XML Serialization
From: Anne van Rossum (anne_at_[hidden])
Date: 2010-09-15 13:19:43


Dear list members,

I guess it's one of the hardest search terms around but I would like to know
if there is any editable XML serialization provided by Boost or other C++
libraries. And I don't mean the kind of thing that requires you to go
jumping around through trees, with iterators etc. I don't want to see any
iterator!

I really iike the XML serialization method that boost::serialization
provides:

    //! Give boost serialization libraries access to private fields
    friend class boost::serialization::access;

    //! Tell which private fields to serialize
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version) {
        ar & boost::serialization::make_nvp("Phase", phase);
        ar & boost::serialization::make_nvp("Period", period);
        ar & boost::serialization::make_nvp("DutyCycle", dutycycle);
    }

Just adding this to a file, and then:

        xml_out << boost::serialization::make_nvp("ApplicationConfig",
config);

Or:
        xml_in >> boost::serialization::make_nvp("ApplicationConfig",
config);

It's awesome! I don't need to care about descending trees, etc. However, the
default serialization class does not allow for different orders of the XML
tags, etc. It doesn't use the "ApplicationConfig" string, but just assumes
that XML tag should be there if this read operation. If you change anything
in the XML file, it is likely you will get a segfault, and you won't know
what is causing the problem exactly.

It would be so great if there is something like this in which the XML files
can actually be edited! I am almost sure that there should be something like
that, but I can't find it.

Thanks in advance,

Anne



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net