开发者

C++: high-level XML serializing library [closed]

开发者 https://www.devze.com 2023-02-02 10:35 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

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 plus boost::<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...

0

精彩评论

暂无评论...
验证码 换一张
取 消