[XML-SIG] <!DOCTYPE type> declaration missing in PrettyPrint()
Ken Roberts
kroberts at abletronics.com
Thu Dec 8 01:33:37 CET 2005
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
More information about the XML-SIG
mailing list