I'm looking for a high-level XML library with an interface similar to boost::serialization
to automatically serialize C++ objects in开发者_如何学运维 XML:
I'm dreaming this scenario (this is the deserialization part):
You register your C++ types associating them to an XML tag (what
boost::serialization::make_nvp
plusboost::<Archive>::register_type
do)For any type you supply a function to say what children that type needs/accepts and where to store them (similar to what
boost::serialization::serialize
do)
That's it. This should be enough to deserialize XML files in a very simple/high-level way. Is there anything like this?
Boost::serialization would be perfect, but it cannot fit the job because of a couple of issues:
The tag associated to a type is defined within such type
serialize
function. For my purpose the tag should be defined before entering such function (ie: in the parent deserialization function).You must know a priori what type you're expecting (what type you're going to read). This is also due to the above issue.
The way boost::serialization
serializes out (ie: generates) XML should already be compatible to what I'm looking for...
精彩评论