From: Matthias Troyer (troyer_at_[hidden])
Date: 2002-11-18 02:27:20
There seems to be a confusion regarding XML serialization.
An XML archive could easily be done by wrapping every output of a
primitive type in tags, e.g. int could be wrapped in <int> 32434
</int>, et.c. Thus XML output is no problem at all. Of course that's
not very useful. However the user can wrap all his saving and loading
in appropriate tags. E.g. a vector could be serialized as
<vector type="int" size="3"> 4 7 2 </vector>
or into more elaborate structures such as:
On Monday, November 18, 2002, at 06:11 AM, Robert Ramey wrote:
> That may be. But a serialization system has to be able to handle ALL
> (not just many) C++ data structures.
It can, as the examples show.
>> That seems a rigid view of XML. Just think of it as a way to markup
>> output you are already producing to make it a bit easier for other
>> tools to
>> work with. Some of the whitespace or other delimiters become tags. If
>> output you are already producing captures various C++ data structures,
>> adding XML markup just enhances the already captured data. That's
>> a dumb way to use the power of XML, but it may be sufficient for
>> serialization needs.
> Serialization files contain tables of objects, pointers, classes etc
> in such
> a way that even text archives are effectively indeciferable. Of
> course they
> are text files so the are readable, producible by any text
> reading/writing program.
> But such processing would be useful only another program could exploit
> the structure of the data. This would be hard to do without the whole
> serialization code.
That's actually the key issue here: since the serialization library
writes additional information the user cannot build a nice XML file
since all his output will be intermixed with the output of the library.
I would thus agree with Robert that XML serialization needs a separate
library in order to produce/read real arbitrary XML files.