Thanks!  That answers my questions.  The apparent asymmetry of handling nodes was confusing, but the distinction of pytypes vs xsi makes some sense.  I would naively agree that a seemingly general purpose function like deannotate should remove everything.  Otherwise, I have to walk the tree twice: once with deannotate and once to unlink remaining nill types.  Or recreate my own deannotate().  Not a big deal either way, though.<br>
<br><div class="gmail_quote">On Tue, Jun 2, 2009 at 12:24 PM, Stefan Behnel <span dir="ltr">&lt;<a href="mailto:stefan_ml@behnel.de">stefan_ml@behnel.de</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;">
Hi,<br>
<div class="im"><br>
Holger wrote:<br>
&gt;&gt; The nil node &lt;Fubar/&gt; is not deannotated as I would expect in the<br>
&gt;&gt; following<br>
&gt;&gt; snippet.  I could not find a reference to this behaviour in the archives<br>
&gt;&gt; or<br>
&gt;&gt; documentation.  Is this a design feature for which there is a work around,<br>
&gt;&gt; or a bug?  I&#39;m using lxml-2.2-py2.5-linux-i686.<br>
&gt;<br>
&gt; Design feature.<br>
<br>
</div>I&#39;d be a little more careful with such a big word. ;)<br>
<div class="im"><br>
<br>
&gt; Only py:pytype/xsi:type attributes get removed by deannotate():<br>
&gt;<br>
&gt;&gt;&gt;&gt; print etree.__version__<br>
&gt; 2.1.5<br>
&gt;&gt;&gt;&gt; help(objectify.deannotate)<br>
&gt;<br>
&gt; Help on built-in function deannotate in module lxml.objectify:<br>
&gt;<br>
&gt; deannotate(...)<br>
&gt;     deannotate(element_or_tree, pytype=True, xsi=True)<br>
&gt;<br>
&gt;     Recursively de-annotate the elements of an XML tree by removing &#39;pytype&#39;<br>
&gt;     and/or &#39;type&#39; attributes.<br>
&gt;<br>
&gt;     If the &#39;pytype&#39; keyword argument is True (the default), &#39;pytype&#39; attributes<br>
&gt;     will be removed. If the &#39;xsi&#39; keyword argument is True (the default),<br>
&gt;     &#39;xsi:type&#39; attributes will be removed.<br>
<br>
</div>Yes, so it&#39;s even implicitly documented. :)<br>
<br>
Anyway, I&#39;m not sure it&#39;s always a good idea to leave this special case in<br>
instead of cleaning everything up. I think if you remove it, you&#39;d get an<br>
empty string result, which may be surprising - but more surprising than not<br>
getting it cleaned up? After all, deannotate() means deannotate()...<br>
<font color="#888888"><br>
Stefan<br>
<br>
</font></blockquote></div><br>