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

Mike C. Fletcher mcfletch@rogers.com
Thu, 16 Jan 2003 19:02:28 -0500

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

    doctype = implementation.createDocumentType(
        "-//OASIS//DTD DocBook MathML Module V1.0//EN",
    newdoc = implementation.createDocument( None, "book", doctype )
    newdoc.replaceChild( doc.documentElement, newdoc.documentElement )
    save( newdoc, destination )

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


  Mike C. Fletcher
  Designer, VR Plumber, Coder