<!DOCTYPE type> declaration missing in PrettyPrint()

Ken Roberts <[email protected]>
Newsgroups gmane.comp.python.xml
Organization Abletronics
Message-ID <[email protected]>
I've seen something related to this in the archives, and it didn't look 
good.

I'm writing a python script to convert a report to XML to import into 
another program.

The problem is that the import function of the other program requires a 
<!DOCTYPE> declaration:

=== EXMAPLE ===
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE IMPORT>
<IMPORT>
     <some elements />
</IMPORT>
===

I've created a script using:

==== SCRIPT ====
import sys
from xml.dom import ext
from xml.dom.ext.reader import Sax2

reader=Sax2.Reader()

doc=reader.fromString("""
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE IMPORT>
<IMPORT>
</IMPORT>""")

(create nodes)

ext.PrettyPrint(doc)
====

Unfortunately, it does not output the <!DOCTYPE> line:
=== EXMAPLE ===
<?xml version="1.0" encoding="UTF-8"?>
<IMPORT>
     <some elements />
</IMPORT>
===

Any suggestions?

-- 

- Ken Roberts
Registered Linux user #296561
Slackin' since 1993
http://www.slackware.com

_______________________________________________
XML-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/xml-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.