<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><style>p {margin:0px;padding:0px;} blockquote { border: 0px; margin-top: 0px; margin-bottom: 0px; }</style></head><body style="">
Hi,<br><font color="#000000" face="Verdana" size="2"><br><blockquote type="cite">Aaron Brady wrote:<br>&gt; I tried to set a 'xmlns' attribute of a node.  'etree.tostring'<br>&gt; produced an attribute name of 'xmlns:xmlns' instead.<br><br>Interesting. I think we should raise a descriptive error when someone tries to<br>set an attribute with that name.<br><br><br>&gt; Target:<br>&gt; <br>&gt; &lt;Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"<br><br>Use<br><br>  root = etree.Element(<br>        '{urn:schemas-microsoft-com:office:spreadsheet}Workbook' )<br><br>and read the docs at<br><br><a href="http://codespeak.net/lxml/tutorial.html#namespaces">http://codespeak.net/lxml/tutorial.html#namespaces</a><br></blockquote><blockquote type="cite">&nbsp;</blockquote></font><font color="#000000" face="Verdana" size="2"><p>&nbsp;</p><p>While I can't see the usecase for it, lxml doesn't allow to use two different ns-prefixes for the</p><p>same namespace through the API, but it does when parsing:<br></p></font><p>&nbsp;</p><p>&gt;&gt;&gt; root = etree.fromstring('&lt;root xmlns:foo="/foo/bar/namespace" xmlns="/foo/bar/namespace"/&gt;')<br>&gt;&gt;&gt; print etree.tostring(root)<br>&lt;root xmlns:foo="/foo/bar/namespace" xmlns="/foo/bar/namespace"/&gt;<br>&gt;&gt;&gt; root.nsmap<br>{'foo': '/foo/bar/namespace', None: '/foo/bar/namespace'}<br>&gt;&gt;&gt; root2 = etree.Element("root", nsmap=root.nsmap)<br>&gt;&gt;&gt; print etree.tostring(root2)<br>&lt;root xmlns:foo="/foo/bar/namespace"/&gt;<br>&gt;&gt;&gt;</p><p>&nbsp;</p><p>Holger&nbsp;</p><p></p><font></font><p></p><p></p><p></p><div class="signature"><br /><br /><br />-- <br />GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!<br />Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx</div></body></html>