|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-11-17 19:39:46
At 12:51 PM 11/17/2002, Robert Ramey wrote:
>From: "Peter Dimov" <pdimov_at_[hidden]>
>
>>> I'm really interested in the XDR format, not because I care about the
>>> format itself, but because others seem to use it as some sort of
litmus
>>> test for serialization libraries. Thus knowing that Robert's library
>>> handles XDR well is of interest.
>
>>FWIW, in my experience, XML is a better test for whether a serialization
>>library handles custom formats well. Sequence-based, header-only formats
>are
>>very similar, but a reasonable XML serializer creates a tree-like
>>representation, with nested tags.
>
>After a cursory investigation as to what it would take to make an XML
>archive, I've concluded that:
>
>a) I don't thing XML is rich enough to capture all possible C++ data
>structures
Uh... I think one of us must be misunderstanding something about XML. If
you can represent serialization of some objects as a character based file,
can't you turn it into dumb XML by wrapping it in
<my_dumb_tag>....</my_dumb_tag>? Perhaps you mean you don't think it is
possible to define a set of tags that themselves are rich enough to capture
all possible C++ data structures?
But so what? You can just supply content directly for any C++ structures
that don't represent well in the XML tagged style. And we know from
experience that many C++ data structures can be usefully represented in an
XML style format.
>b) This would imply the creation of a system of reflection for C++
> i) I not convinced this is a good idea
> ii) should be dealt with as an indepent project in any case
>
>c) XML has a central task to represent data in a platform/programming
>language
>independent way. Serialization has the central task of saving/restore
the
>totality of the state of C++ data structures. These tasks are not
>identical
>and any course of action based on the presumption that they are is
>doomed to be frustrating an most likely a failure in my opinion.
That seems a rigid view of XML. Just think of it as a way to markup the
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 the
output you are already producing captures various C++ data structures,
adding XML markup just enhances the already captured data. That's probably
a dumb way to use the power of XML, but it may be sufficient for
serialization needs.
On the input side, I don't think anyone was suggesting being able to parse
the full generality of XML, but just to be able to take in the exact markup
that was previously output.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk