[XML-SIG] Getting DOCTYPE information using SAX

Lars Marius Garshol larsga@garshol.priv.no
12 Oct 2000 00:20:33 +0200

* Ben Wiegert
| I am a Python newbie.  I have gotten my code to read in and parse
| XML using SAXLIB from PyXML.  I can also manipulate what I read in
| and output it to XML.  The only thing that I can not seem to grab is
| the DOCTYPE line (or the XML header Line, but I am mainly concerned
| with the DOCTYPE).  I need to specify my DTD in the outbound XML
| file?  Is there an event in SAX that allows me to get that info?

In SAX 2.0 as it exists in Python 2.0 and PyXML there is not.

There is an extension handler (in SAX 2.0 ext) known as LexicalHandler
that does have an event for this.  xmlproc will support this, once
Python 2.0 is out the door and I have time to sit down and write a SAX
driver for it.  (There is one written already, but it's for an older
form of SAX.)

--Lars M.