[lxml-dev] lxml.objectify.deannotate refuses to clean nil nodes
John Lovell
jlovell at nwesd.org
Mon Jul 20 18:45:45 CEST 2009
Stefan:
Has their been any action on this? I really want to help and I am really swamped.
Sorry,
John W. Lovell
Web Applications Engineer
Northwest Educational Service District
1601 R Avenue
Anacortes, WA 98221
(360) 299-4086
jlovell at nwesd.org
www.nwesd.org
Together We Can ...
-----Original Message-----
From: Stefan Behnel [mailto:stefan_ml at behnel.de]
Sent: Saturday, June 06, 2009 1:49 AM
To: Robert Pierce; John Lovell
Cc: lxml-dev at codespeak.net
Subject: Re: [lxml-dev] lxml.objectify.deannotate refuses to clean nil nodes
Hi,
Robert Pierce wrote:
> On Thu, Jun 4, 2009 at 8:30 AM, John Lovell wrote:
>> Stefan Behnel wrote:
>>> - strip_attributes(tree, *attribute_names)
>>> remove all named attributes from a tree
>>>
>>> - strip_elements(tree, *element_names)
>>> remove all named elements from a tree, including their subtrees (alt:
>>> "strip_subtrees")
>>>
>>> - strip_tags(tree, *element_names)
>>> remove all named elements from a tree, merging their children and text
>>> content into their parents
Done:
https://codespeak.net/viewvc/?view=rev&revision=65612
https://codespeak.net/viewvc/lxml/trunk/src/lxml/cleanup.pxi?view=markup&pathrev=65612
>>> Comments?
>>
>> My comments would be: brilliant, useful, wonderful!
>
> I agree! Solves my problem and then some.
Since you two seem to be very happy about this feature, what about writing up some docs/doctests for it?
A new section here sounds like the right place:
http://codespeak.net/svn/lxml/trunk/doc/api.txt
-> http://codespeak.net/lxml/api.html
Maybe the tutorial could also benefit from a short reference.
Holger, could you replace the current deannotate() implementation in lxml.objectify and add the xsl:nil cleanup option as we discussed? I expect it to be a little slower than before due to the more general implementation. If you have some code at your hands to benchmark it, please do.
Unless Ian (or someone else) beats me to it, I'll also look through lxml.html next week to check for places where this can be used. For example, clean.py looks like an obvious candidate.
Stefan
More information about the lxml-dev
mailing list