Jim, 26.12.2010 00:32:
On Dec 25, 5:33 am, Stefan Behnel wrote:
lxml knows about this special case, so you can write
{http://www.w3.org/XML/1998/namespace}lang
and lxml will take care of using the right prefix.
Stefan, thank you for the software, which has helped me a great deal.
I tried that exact thing, among a number of others, and it didn't work
for me (I got ns0).
Works for me, at least with a recent SVN version:
Python 2.7.1rc1+ (trunk:86636, Nov 21 2010, 09:18:37)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxml.etree as ET
>>> el = ET.Element('test',
... {'{http://www.w3.org/XML/1998/namespace}lang': 'de'})
>>> ET.tostring(el)
'<test xml:lang="de"/>'
Anyway, I applied a patch that makes sure it will always use the 'xml'
prefix for this namespace. Will be in 2.3 final.
Stefan
--
http://mail.python.org/mailman/listinfo/python-list