[XML-SIG] py2exe and switching from PyXML 4Suite
Anders Bruun Olsen
Mon, 16 Dec 2002 07:04:14 +0100
On Sun, Dec 15, 2002 at 02:25:04PM -0700, Uche Ogbuji wrote:
> > > Because you're such a nice guy, I'll ditch the tease for you :-)
> > You can also do these much more easily using XPath...
> > from Ft.Xml import XPath
> > def getElementsByTagName(node,name)
> > return XPath.evaluate(node,".//" + name)
> I think my generator approach would be faster, but this XPath approach has the
> advantage of working in Python 2.0 and 2.1. Mine is 2.2+.
Okay, I have now read up on iterators and generator - WOW! that's so
cool!.. I immediately rewrote the search part of my program that had
been giving me problems - with generators it just works perfectly and
the code is so much simpler!
I have implemented Uche's generators now and the function that loads an
XML file into my programs internal format has now gone from 6-7 seconds
load time to 1-2 second for the 219Kb XML file I am using for testing on
my Athlon XP 1800+.
Now - my program also saves it's data to disk by creating a dom and
filling it with the right nodes and then writing it to disk with
PrettyPrint (which takes over 20 seconds on my machine with the 219Kb
file). I am sure this can be done much faster with 4Suite somehow,
right now I use xml.dom.implementation to create the empty dom, I am
betting it is possible to do the same using domlette, I just can't grok
how without a little helping hand :)
Also it would be great if there was a way to ditch PrettyPrint as I
would then be completely rid of PyXML, which seems to be giving py2exe
Once again, thanks for the help so far, you guys are great! :)
-----BEGIN GEEK CODE BLOCK-----
GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V
PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y?
------END GEEK CODE BLOCK------