Boost logo

Boost :

From: Anatoli Tubman (anatoli_at_[hidden])
Date: 2004-04-04 06:46:20

Robert Ramey wrote:
> I briefly considered this approach. I imagined that upon archive creation
> the XML input could be parsed into a node tree. (insert plug for spirit
> here) The load_override function would be altered to search the correct part
> of the tree. So this would work and be pretty clean. I'm sure other
> approaches such as using SAX or DOM to parse the tree would work as well.
> Maybe there's another way I never thought of.
> The main reason I rejected the idea was that I didn't see it working with
> arbitrarily size streams. I envision serialization being used with stream
> much larger then available memory. This suggested to me an "on the fly"
> loader rather than a "pre-loaded".

Loading the entire archive is not necessary. The other approach is to
acquire a *description* of the data structure being deserialized, and
process the XML stream sequentially. That is, operator<< does not do
deserialization by itself, but inserts a member *descriptor* into a
map. When all data members are collected in this fashion, they are
deserialized as corresponding tags come in.

IOW one needs random access to *either* the data stream *or* to the
data structure being deserialized. Data streams are too big, so we
should choose data structures instead.

One doesn't need the entire tree of data structures either, only
the node currently being processed, because descendants changing
parent nodes are not supported.

This works because a typical class is much smaller than a typical
data stream, which usually contains many instances of the same class.
I have some experience with one (pre-XML, pre-C++) serialization library
that does (approximately) just that. It uses a custom tagged format, but
there's no reason why it shouldn't work with XML and C++.

Best regards,

Anatoli Tubman
PTC Israel (Haifa)
Tel. (+972) 4-8550035 ext. 229

Boost list run by bdawes at, gregod at, cpdaniel at, john at