[lxml-dev] namespace strangeness in lxml 1.1

Stefan Behnel stefan_ml at behnel.de
Tue Jul 1 19:19:36 CEST 2008


Hi,

Eric Jahn wrote:
> On Tue, 2008-07-01 at 07:20 +0200, Stefan Behnel wrote:
>>     type = etree.QName(NS2 + "...")
> 
> No, I don't want the prefix resolved the the url, so I guess my only
> option is to do something like the following and just pass the type
> value a string with the namespace prefix explicity stated: 
> 
> child1 = etree.SubElement(root,NS2 + "secondelement", nsmap=NSMAP, type
> = "NS2:someattribute")

Ah, now that you mention it, the above doesn't actually work. It only works
for element text, not for attributes. I'll see if I can change that.


> I think the tutorial could benefit from a small section on creating
> schema docs as opposed to instance docs.  I'd be happy to submit the
> start of such a new section?  Would this be helpful?  I know it would
> have saved me a little time...

Please do, any contribution is appreciated.

Stefan


More information about the lxml-dev mailing list