[XML-SIG] Optimising/strategies for DOM/XSL lookup-parsing

Kevin Russell krussll@cc.UManitoba.CA
Mon, 22 Mar 1999 16:37:00 -0600


>> If this isn't possible, is it possible to 'save' a DOM tree to an
external
>> file and re-read it in once a relevant XSL query is ready to be acted
upon?
>You could try to [c]pickle the documents. [c]pickle is
>a standard module that allows you to serialize (e.g. write/read)
>complex python objects ("cpickle" is implemented in "C"
>and much faster than "pickle"). However, objects must obey
>some restrictions to be picklable. I am not sure, whether
>DOM objects fulfill them, just try it.

I actually tried this once (though only with pickle, not cpickle).
There's a class reference somewhere near the top of the DOM
tree that will prevent pickling.  Just del it from the appropriate
dictionary, and you're fine.

BUT:  unpickling the file took *considerably* longer than just
reading in and parsing the XML in the first place. Unless
cpickle is a helluva lot faster, there won't be much saved time.

-- Kevin