[lxml-dev] Bug: type annotation namespace-prefix goes missing
jholg at gmx.de
jholg at gmx.de
Fri Feb 8 08:52:22 CET 2008
Hi,
> > it's not related to XPath, it's just that you change the order of the
> children
> > in your test:
> >
> > -------------------------
> > import lxml.etree
> > import lxml.objectify
> >
> > [...]
> >
> > gives the same result. I don't even think it's related to objectify.
Yep, right. Here's without any objectify-ism:
>>> 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 pytype="str">tit</title>
<text>foo</text>
</b>
</a>
>>>
>>> print etree.__version__
2.0.alpha4
>>>
>>>
FWIW this also fails with older versions, but:
- 1.2.1 fails with the objectify version, but not the "pure" etree one
- 1.3beta fails with the objectify version, but not the "pure" etree one
Holger
--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/lxml-dev/attachments/20080208/9259dd64/attachment.htm
More information about the lxml-dev
mailing list