boost serialization : attributes and node ordering
I came across a situation where I wanted to have some flexibility with
object serialization. I was thinking about two things:
1. Object attributes, for example, can we have something like this
with boost:
<pa2 class_id="0" tracking_level="0" version="0"
Type="MyClassType">
<sourceMember>10</sourceMember>
<destMember>20</destMember>
</pa2>
instead of:
<pa2 class_id="0" tracking_level="0" version="0">
<Type>MyClassType</Type>
<sourceMember>10</sourceMember>
<destMember>20</destMember>
</pa2>
that is - does it support custom node/element attributes? These would
be some "extra" info that I would want to embed into the xml file
along with the object's serialized state.
2. With the serialized xml file that I get, if I change the order of
the elements, it throws an exception. For example if the above is the
xml generated, I modify it to the following and deserialize it, it
doesn't work.
<pa2 class_id="0" tracking_level="0" version="0">
<Type>MyClassType</Type>
<destMember>20</destMember>
<sourceMember>10</sourceMember>
</pa2>
(Note the order of sourceMember and destMember.) I wanted that
flexibility with the order.
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]