[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(
        "book",
        "-//OASIS//DTD DocBook MathML Module V1.0//EN",
        "http://www.oasis-open.org/docbook/xml/mathml/1.0/dbmathml.dtd",
    )
    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

_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/