[lxml-dev] objectify.deannotate: call to etree.cleanup_namespaces in 2.1beta

jholg at gmx.de jholg at gmx.de
Tue Jul 1 09:37:42 CEST 2008


Hi,


> Holger Joukl wrote:
> > I have a usecase where I need to deannotate an objectified tree
> > and then manually set py:pytype or xsi:type attributes.
> > 
> > However, this seems to be getting difficult with 2.1beta as deannotate 
> > wipes out all nsmap information with its call to cleanup_namespaces(),
> > and I cannot set a namespaced 
> > 
> > attribute through <elt>.set(...)
 Just to be precise: 

A namespaced attribute value like "xsd:string".

It is easy to set a ns-qualified attribute using Clark notation, as 
anywhere

in lxml. 

 
> > could we make the call to cleanup_namespaces optional (defaults 
> > to True) in deannotate()? 
> 
> I wasn't entirely sure if it was a good idea when I added it. I guess 
> it's
> best to keep it out or make it optional (default False).
> 


I'll remove it, then.

Rationale: lxml does a good job of keeping namespace declarations clean 
when

adding elements to a tree anyway, so with objectify's default nsmap 
namespace

declarations concerning xsi:type and py:pytype are usually located at the 
root element

only.

Anyone who needs a real clean document can still conveniently call 
etree.cleanup_namespaces()

after deannotate().

 Holger


-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/lxml-dev/attachments/20080701/9b2ed745/attachment.htm 


More information about the lxml-dev mailing list