Hello
I've been working on a script that generates a XML document, and output needs to have encoding "ISO-8859-1" defined in the first <?xml ...> tag.
I found this example on http://infohost.nmt.ed u/tcc/help/pubs/pyxml/creating.html
This should produce something like
However, when I try it, the encoding part is not generated. Also, AFAIK "UTF-8" is the default coding and I require something else...
So how do you set what encoding to use?
I've been working on a script that generates a XML document, and output needs to have encoding "ISO-8859-1" defined in the first <?xml ...> tag.
I found this example on http://infohost.nmt.ed u/tcc/help/pubs/pyxml/creating.html
Code:
import xml.dom.minidom
#import xml.dom.ext as domExt
dom = xml.dom.minidom.getDOMImplementation()
doctype = dom.createDocumentType("html",
"-//W3C//DTD XHTML 1.0 Strict//EN",
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" )
doc = dom.createDocument( None, "html", doctype )
(... snip ...)
Code:
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html/>
So how do you set what encoding to use?
Comment