[XML-SIG] Speeding up DOM reading

Alexandre Fayolle Alexandre.Fayolle@logilab.fr
Mon, 17 Dec 2001 15:25:28 +0100 (CET)


On Mon, 17 Dec 2001 horst@freedict.de wrote:

> Hello,
> 
> I finally figured out how to get / set attributes - use name spaces. But
> things work fine, and I was able to turn on validation, which turns out
> to be fairly slow (The DTD is large (TEI)).
> 
> Reading the documentation, it appreas that there are differnt modules
> around for reading in (and validate) XML, but I never found a hint on
> how to do it. What should I do instead of:


Well you have a lot of unrequired imports in the sample. The only one you
need is from "xml.dom.ext.reader import Sax2"

However, il you need speed and can trade it for a somehow less dom
compliant implementation, you may want to try (since you seem to have
4Suite installed):

from Ft.Lib.pDomlette import pDomletteReader
doc = pDomletteReader.PyExpatReader().fromStream(xmlfile, validate = 1,
                    catName= "/var/lib/sgml/freedict/public.soc")


Alexandre Fayolle
-- 
LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org
Narval, the first software agent available as free software (GPL).