[XML-SIG] fast dump/restore of an XML document?

Greg Stein gstein@lyra.org
Tue, 16 May 2000 21:29:37 -0700 (PDT)


On Tue, 16 May 2000, Anthony Baxter wrote:
> >>> Lars Marius Garshol wrote
> > Marshal can basically store/load anything except object instances.
> > So lists, dictionaries and so on are possible, but not objects.
> 
> That's what I was thinking - so to marshal, you'd have to convert it
> to a structure of lists and dictionaries. I was just curious if there
> was some secret protocol an object can use to marshal itself (there
> didn't seem to be in Python/marshal.c)

Yup... this was my thought. I think qp_xml gives you a good basis for
taking the pyexpat callbacks and constructing list/dict structures.

> > <URL: http://www.python.org/doc/current/lib/module-marshal.html >
> > Marshal is, I think, much faster than pickle, so it's certainly worth
> > a try. 
> 
> Only if it's not more expensive to convert it into a marshallable form.

The conversion would probably take a while on a large data set -- you'd be
iterating over every XML node. I'd recommend gutting qp_xml.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/