[lxml-dev] Bug: type annotation namespace-prefix goes missing

jholg at gmx.de jholg at gmx.de
Mon Feb 11 09:24:35 CET 2008


Hi Stefan,


> jholg at gmx.de wrote:
> > Yep, right. Here's without any objectify-ism:
> [...]
> > >>> print etree.__version__
> > 2.0.alpha4
> 
> Hmmm, I don't get that with 2.0 final and libxml2 2.6.30. Could you 
> double
> check that on your platform?
 You're right. I just checked 2.0 final and the current trunk, and I don't 
see

that problem with neither of them (libxml2 2.6.27):

 >>> from lxml import etree
>>> xml = etree.fromstring(
...      '<a xmlns:py="http://codespeak.net/lxml/objectify/pytype">'
...      '<b name="b1"><title 
py:pytype="str">tit</title><text>foo</text></b>'
...      '<b name="b2"><text>bar</text></b></a>')
>>>
>>> print etree.tostring(xml, pretty_print=True)
<a xmlns:py="http://codespeak.net/lxml/objectify/pytype">
  <b name="b1">
    <title py:pytype="str">tit</title>
    <text>foo</text>
  </b>
  <b name="b2">
    <text>bar</text>
  </b>
</a>
 
>>>
>>> foo = xml[0]
>>> bar = xml[1]
>>> print etree.tostring(xml, pretty_print=True)
<a xmlns:py="http://codespeak.net/lxml/objectify/pytype">
  <b name="b1">
    <title py:pytype="str">tit</title>
    <text>foo</text>
  </b>
  <b name="b2">
    <text>bar</text>
  </b>
</a>
 
>>>
>>> xml[0] = bar
>>> xml.append(foo)
>>>
>>> print etree.tostring(xml, pretty_print=True)
<a xmlns:py="http://codespeak.net/lxml/objectify/pytype">
  <b name="b2">
    <text>bar</text>
  </b>
  <b name="b1">
    <title py:pytype="str">tit</title>
    <text>foo</text>
  </b>
</a>
 
>>> print etree.__version__
2.0.0-51192
>>> print etree.LIBXML_VERSION
(2, 6, 27)
>>> print etree.LIBXSLT_VERSION
(1, 1, 20)
>>> 
 Holger


-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/lxml-dev/attachments/20080211/a13ec095/attachment-0001.htm 


More information about the lxml-dev mailing list