|
Boost : |
From: Jared McIntyre (jmcintyre_at_[hidden])
Date: 2006-06-22 17:44:03
I've been using serialization to XML for a while now. Its worked very well for what I originally needed. However, a
number of requests have come my way for enhancements to our system based on the concept that the file is XML, but they
aren't really possible under the existing framework.
The first item involves style sheets (and potentially other similar tags). Currently there is no way to insert
<?xml-stylesheet type="text/xsl" href="file.xslt" ?> into the file from code. And if I do it manually, serializer
won't be able to load the file. Is there any interest out there in this kind of functionality (adding tags like this
from code, and ignoring such tags on load)? If so, could someone point me to where to look in the code to put together
a prototype?
The second thing is a concept that conflicts with the existing versioning scheme. I'm asked regularly why the
deserializer cares if there are tags in the file that it doesn't know about (most people assume these will be
ignored). The reason they want this is they want a newer version of the code to add a few tags to the file, but the
older version continue to read the file while skipping those new items. For example, the original version of a class
would be:
<shirt class_id="5" tracking_level="0" version="0">
<color>red</color>
<size>large</size>
</shirt>
and the second version would be
<shirt class_id="5" tracking_level="0" version="1">
<color>red</color>
<size>large</size>
<material>cotton</material>
</shirt>
Their thinking is that if the old code loads the file, it should just ignore the <material> tag and load happily.
However, in order of the new code to read the old file, the version has to be revved to 1 so that it knows to add a
<material> value on load. In doing that version rev, even if it could ignore the <material> tag, the old code would
see that version 1 and assume it didn't know how to load it. Can anyone think of a way around this short of changing
the version scheme, which doesn't seem like an option.
Thanks,
Jared McIntyre
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk