convert xhtml back to html
Stefan Behnel
stefan_ml at behnel.de
Thu Apr 24 15:55:56 EDT 2008
Tim Arnold wrote:
> hi, I've got lots of xhtml pages that need to be fed to MS HTML Workshop to
> create CHM files. That application really hates xhtml, so I need to convert
> self-ending tags (e.g. <br />) to plain html (e.g. <br>).
This should do the job in lxml 2.x:
from lxml import etree
tree = etree.parse("thefile.xhtml")
tree.write("thefile.html", method="html")
http://codespeak.net/lxml
Stefan
More information about the Python-list
mailing list