loxun, : http://pypi.python.org/pypi/loxun/. CPython 2.5 Jython 2.5, IronPython.
:
with open("...", "wb") as out:
xml = XmlWriter(out)
xml.addNamespace("xhtml", "http://www.w3.org/1999/xhtml")
xml.startTag("xhtml:html")
xml.startTag("xhtml:body")
xml.text("Hello world!")
xml.tag("xhtml:img", {"src": "smile.png", "alt": ":-)"})
xml.endTag()
xml.endTag()
xml.close()
:
<?xml version="1.0" encoding="utf-8"?>
<xhtml:html xlmns:xhtml="http://www.w3.org/1999/xhtml">
<xhtml:body>
Hello world!
<xhtml:img alt=":-)" src="smile.png" />
</xhtml:body>
</xhtml:html>
, API , Unicode .