[XML-SIG] How to add standalone="no" to my xml declaration

Stephen Briley sdb1031 at gmail.com
Sat Apr 15 02:35:29 CEST 2006


I'm trying to learn about Python and XML.  I would like to be able to add
standalone="no" to my xml declaration when writing an xml file, but I am
unable to figure out how.  So far, I have the following code:

import xml.dom.minidom
doc2 = xml.dom.minidom.Document()
print doc2.toxml('iso-8859-1')

Which produces the following XML declaration:
<?xml version="1.0" encoding="iso-8859-1"?>

However, my goal is to have the XML declaration look like the following:
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>

The following link mentions "standalone" as a Document class variable, but I
am unsure how to make this work or even if I am on the right track.
http://epydoc.sourceforge.net/stdlib/private/_xmlplus.dom.minidom.Document-class.html#encoding

Any help would be greatly appreciated.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/xml-sig/attachments/20060414/c6275f06/attachment.html 


More information about the XML-SIG mailing list