[XML-SIG] Better recipe for saving a file with a doctype declaration?

Martin v. Löwis martin@v.loewis.de
17 Jan 2003 10:17:51 +0100


"Mike C. Fletcher" <mcfletch@rogers.com> writes:

> I'm using the following to write out my xml document with a doctype
> declaration.  Is this the preferred way to go about it?

If you are using the DOM: Sure! If you need more stuff in the DOCTYPE
declaration (such as an internal subset), you could also write it out
yourself, and then only print the document root.

> and on a related note, how does one specify the encoding for the
> document when writing (e.g. as "ISO-8859-1")?

If you have the latest PyXML, and if you are using minidom, you can
use the encoding= argument of .toxml.

Regards,
Martin