<!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>> I tried to set a 'xmlns' attribute of a node. 'etree.tostring'<br>> 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>> Target:<br>> <br>> <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"> </blockquote></font><font color="#000000" face="Verdana" size="2"><p> </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> </p><p>>>> root = etree.fromstring('<root xmlns:foo="/foo/bar/namespace" xmlns="/foo/bar/namespace"/>')<br>>>> print etree.tostring(root)<br><root xmlns:foo="/foo/bar/namespace" xmlns="/foo/bar/namespace"/><br>>>> root.nsmap<br>{'foo': '/foo/bar/namespace', None: '/foo/bar/namespace'}<br>>>> root2 = etree.Element("root", nsmap=root.nsmap)<br>>>> print etree.tostring(root2)<br><root xmlns:foo="/foo/bar/namespace"/><br>>>></p><p> </p><p>Holger </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>