|
Boost Users : |
Subject: [Boost-users] [serialization] xml files that can be hand-edited
From: Paul (elegant_dice_at_[hidden])
Date: 2010-03-17 01:08:39
Hi,
I'd like to build some insurance into my XML files. If there is some sort
of problem in the future (either with boost, or my application), I'd like to
be able to hand-edit the serialized XML archive files. Even better would
be to allow XML-tools to manipulate a batch of the XML files, but one thing
at a time.
One big problem with the current XML format is that the
class_id="3" tracking_level="0" version="0" preamble is only included the
FIRST time a class is dumped to the file.
Example:
<brother class_id="3" tracking_level="0" version="2">
.. etc, and then later in the file ...
<sister>
... etc ...
If something happened (eg impossible-to-upgrade-format-change) and I needed
to manually move the <sister> item above the <brother> item (maybe into a
different branch of tags), then I would need to KNOW that the brother class
is the same as the sister class (which is not obvious) AND move the preamble
into the sister tag.
I would also need to re-number all the class_ids, but those appear to be
only used if I'm tracking a pointer AND I have multiple instances of that
pointer in the file. If the item is not a pointer, it looks like the
class_id is *always* thrown away.
So, I'm thinking of:
a) never allow tracking (its a compromise to give me the next item)
b) never writing out class_id or tracking_level
c) always writing out the version
the result would look like this:
<brother version="2">
.. etc, and then later in the file ...
<sister version="2">
That way items in the XML file could be rearranged by hand and I would not
need to do the difficult task of adjusting the tag attributes.
Does this sound sensible?
I had a look into inheriting and creating my own archive, but it appears all
of the changes required happen in the basic_oarchive_impl, which seems
pretty fundamental and hard to override.
Will I need to create and maintain my own patch in order to "hack" this
change.
Thanks,
Paul
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