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

Christian Zagrodnick cz at gocept.com
Fri Feb 8 08:14:06 CET 2008


On 2008-02-07 17:45:02 +0100, Stefan Behnel <stefan_ml at behnel.de> said:

> Hi,
> 
> Christian Zagrodnick wrote:
>> Note the last <text node where it says pytype instead of py:pytype.
>> 
>> I think is has something todo with the xpath, but I cannot really
>> figure out what.
>> 
>> That's with lxml 2.0 and python 2.4
> 
> 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
> 
> xml = lxml.objectify.XML(
>     '<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 lxml.etree.tostring(xml, pretty_print=True)
> 
> foo = xml['b'][0]
> bar = xml['b'][1]
> foo['text'] = 'FOO!'
> 
> print lxml.etree.tostring(xml, pretty_print=True)
> 
> foo = xml['b'][0]
> bar = xml['b'][1]
> xml['b'] = [bar, foo]
> 
> print lxml.etree.tostring(xml, pretty_print=True)
> -------------------------
> 
> gives the same result. I don't even think it's related to objectify.

Ah. I tried to reproduce it w/o the XPath but probably did something 
else different then.

> 
> I'll look into it when I find the time.

Thanks!

-- 
Christian Zagrodnick

gocept gmbh & co. kg  ·  forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891





More information about the lxml-dev mailing list