Including standalone="no" in XML declaration

S

sdb1031

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top