[XML-SIG] py2exe and switching from PyXML 4Suite

Anders Bruun Olsen anders@bruun-olsen.net
Mon, 16 Dec 2002 20:23:04 +0100


On Mon, Dec 16, 2002 at 06:55:59AM -0700, Uche Ogbuji wrote:
> Generators do absolutely rock.  I'm glad you got a good opportunity to learn 
> them as a side effect of trying to figure out Python/XML.

Yeah, I have learned so much during the last week or so - it's been
great :)

> > 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,
> > but how?
> Rather than 
> from xml.dom.ext import PrettyPrint
> use
> from Ft.Xml.Domlette import PrettyPrint
> Domlette's PrettyPrint is written in C (with Python fall-back), and is much 
> faster.
> > 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 :)
> Ouch.  So you're using 4DOM, not Domlette, which is probably a bigger reason 
> for slow performance than PrettyPrint

WOW! From a save-time of 25-30 seconds to 2-3 seconds!.. now my app is
starting to look like something :)

> Again I must warn you that Domlette approximates DOM and is not a full DOM.  
> You already found the lack of getElementsByTagName.  There are other subtle 
> differences.  That having been said, I have not run into a situation where 
> Domlette is not a suitable DOM substitute.

It did what I needed, which is just creating elements and setting
attributes..

> > 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
> > some problems.
> Well, the above would remove dependency from PyXML.  However, I think we would 
> all like at least a report of the problems py2exe is having with PyXML, since 
> it would be nice if that combo worked.

I'll definitely report back my findings - right now I am having a
struggle of getting wxPython to work correctly, so until those
problems are worked out I can't use py2exe.. I'll post on the list once
I have gotten wxPython to behave..

> > Once again, thanks for the help so far, you guys are great! :)
> I'm glad we've been of help.
> We would in turn be grateful at some point if you were to write up some of 
> your experiences and techniques in order to help others through the same 
> issues.

I'm not much of a writer, but I should be able to make a collection of
links and comment upon those so that my mistakes can be avoided by
others who use it to learn Python+XML.

-- 
Anders
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
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------
PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41