I agree!  Solves my problem and then some.<br><br><div class="gmail_quote">On Thu, Jun 4, 2009 at 8:30 AM, John Lovell <span dir="ltr">&lt;<a href="mailto:jlovell@nwesd.org">jlovell@nwesd.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
My comments would be: brilliant, useful, wonderful!<br>
<br>
...<br><div><div class="h5">
<br>
That sounds like functionality that belongs into lxml.etree, although it&#39;s partly available in lxml.html already. What about adding some more, then?<br>
<br>
- strip_attributes(tree, *attribute_names)<br>
  remove all named attributes from a tree<br>
<br>
- strip_elements(tree, *element_names)<br>
  remove all named elements from a tree, including their subtrees (alt:<br>
&quot;strip_subtrees&quot;)<br>
<br>
- strip_tags(tree, *element_names)<br>
  remove all named elements from a tree, merging their children and text content into their parents<br>
<br>
Since lxml.html provides a drop_tag() Element method, I considered<br>
drop_tags() for the last one, but thought that &quot;strip_*&quot; might be slightly better for consistency here. Alternatively, we might use &quot;drop_*&quot; for everything, but &quot;strip&quot; is a common thing in Python, while &quot;drop&quot; isn&#39;t.<br>

Plus, there are &quot;drop_*()&quot; /methods/ in lxml.html, which make sense on an Element and do not traverse into subtrees. &quot;strip&quot; makes no sense in that context.<br>
<br>
I also vote for functions instead of methods here since they work on complete (sub-)trees rather than a single Element object. A function makes this clearer.<br>
<br>
Comments?<br>
<br>
Stefan<br>
<br></div></div></blockquote></div><br>