[lxml-dev] xmlns / xmlns:xmlns inconsistency

Stefan Behnel stefan_ml at behnel.de
Fri Sep 12 09:05:29 CEST 2008


Hi,

Aaron Brady wrote:
> I tried to set a 'xmlns' attribute of a node.  'etree.tostring'
> produced an attribute name of 'xmlns:xmlns' instead.

Interesting. I think we should raise a descriptive error when someone tries to
set an attribute with that name.


> Target:
> 
> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"

Use

  root = etree.Element(
        '{urn:schemas-microsoft-com:office:spreadsheet}Workbook' )

and read the docs at

http://codespeak.net/lxml/tutorial.html#namespaces

Stefan


More information about the lxml-dev mailing list