[lxml-dev] namespace strangeness in lxml 1.1

Eric Jahn eric at ejahn.net
Mon Jun 30 22:28:10 CEST 2008


On Mon, 2008-06-30 at 20:11 +0000, Eric Jahn wrote:
> ...The second odd behavior is that, for
> subelements, all the namespace declarations are automatically redeclared
> in the subelement tag, which is redundant. 

I see that this second error goes away when I use

child1 = etree.SubElement(root,NS2 + "secondelement", nsmap=NSMAP, type
= NS2 + "someattribute")

instead of 

root = etree.Element(NS1 + "firstelement", nsmap=NSMAP)
element = etree.Element(NS2 + "secondelement", nsmap=NSMAP, type = NS2 +
"someattribute")
root.append(element)

-Eric



More information about the lxml-dev mailing list