[lxml-dev] ElementTree.write default_namespace argument

Richard Lewis richardlewis at fastmail.co.uk
Tue May 12 15:38:22 CEST 2009


Hi there,

I have lxml version 2.1.5, Python 2.5 both installed from Debian
packages. I'd like to be able to use the default_namespace argument to
ElementTree's write method. However, I get the following error:

 Traceback (most recent call last):
   File "./join-html-pages.py", line 62, in <module>
     main()
   File "./join-html-pages.py", line 59, in main
     document.write(file(new_filename, 'w'), encoding='utf-8', method='html', default_namespace='html')
   File "lxml.etree.pyx", line 1576, in lxml.etree._ElementTree.write (src/lxml/lxml.etree.c:16699)
 TypeError: write() got an unexpected keyword argument 'default_namespace'

Is this expected behaviour?

My application is extracting nodes from numerous XHTML documents and
merging them into one HTML document. The bit that's going wrong is
writing the resultant HTML to a file. I'm not really interested in it
being correct XHTML or in using the correct namespace. So any
alternative solutions would also be of interest.

Cheers,
Richard


More information about the lxml-dev mailing list