5 May 17:46
Re: lxml - addition of argument to control namespace declaration serializtion
From: Stefan Behnel <stefan_ml <at> behnel.de>
Subject: Re: lxml - addition of argument to control namespace declaration serializtion
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-05-05 15:46:56 GMT
Subject: Re: lxml - addition of argument to control namespace declaration serializtion
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-05-05 15:46:56 GMT
Hi, these things are best discussed on the list. Grimes, David wrote: > In 1.3.5-1.3.6 timeframe, there was a patch introduced to > _writeNodeToBuffer() from serialization.pxi which forced namespace > declarations from parent nodes to be serialized onto the sub-tree root > node. In general, and with respect to XML standards, this make a great > deal of sense (so you don't have prefixed elements/attributes without the > corresponding namespace declaration). > > But, the application I've been building essentially takes an XML document > and makes template-string blocks of text out of various sub-trees, to be > later combined back into a full document using __getitem__ substitution in > the form of "%(token)s" string formatting. > > The nsdecl patch of 1.3.5/6 causes interesting behaviour when the sub-tree > being rendered is done in, for example, a loop - one "formatting > operation" per iteration. Also interesting is when many such sub-trees > are combined to form a document which (in my case) we know will have the > declarations on the ultimate root node. What you mean is that we actually make a copy of a non-root node and then copy over the namespace declarations of the ancestors. You say "interesting behaviour". Does that refer to the performance overhead or is there a 'real' problem you see? Looking at the code now, I see some potential optimisations, so if it's just the performance, here's a (trunk) patch that should give a bit of(Continue reading)
RSS Feed