[XML-SIG] Replicating DTD information using XMLFilterBase and XMLGenerator
jsulak at gmail.com
Sun Jul 27 18:40:13 CEST 2008
I'm attempting to use xml.sax.utils.XMLFilterBase and XMLGenerator to
take an input XML document, filter out certain elements, and output
the result to a second XML file. I have it mostly working, except
that I lose the DTD declaration and anything (processing instructions
or comments) before the root element. I believe I'm supposed to be
using a LexicalHandler to get the information from the DTD, but I have
not been able to figure out how to do this, or how to integrate it
with the rest of the code.
I'm pretty new at using Python (and SAX, for that matter) to work with
XML, so I'm hoping this is a fairly simple question. I'm basing my
code off of Uche Ogbuji's example at
Any help would be appreciated.
More information about the XML-SIG