[lxml-dev] lxml.objectify.deannotate refuses to clean nil nodes
jholg at gmx.de
jholg at gmx.de
Thu Jun 4 14:42:27 CEST 2009
Hi,
> jholg at gmx.de wrote:
> > A compromise may be to add another keyword arg "nil" to deannotate() to
> > allow for xsi:nil removal if needed (defaults to False, of course :)
>
> I think that should be done, yes. A "nil=False" keyword would nicely solve
> this. And disabling it by default makes sense for two reasons: backwards
> compatibility and the fact that xsi:nil may be used in existing documents.
>
> Is a plain "nil" enough or should we use "xsi_nil"?
I think xsi_nil is clearer.
What if we add a general deannotation function that lets you strip a tree off arbitrary attributes? Something like
def remove_attributes(element_or_tree, *attrs):
...
which takes either ns-qualified strings or (ns, attrname) tuples and removes these attributes wherever found. objectify.deannotate() would then be a special case of this and share the implementation.
Then again maybe that's overkill...
Holger
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
More information about the lxml-dev
mailing list