[XML-SIG] Expanding external entities

Nicolas Chauvat Nicolas.Chauvat@logilab.fr
Mon, 27 Aug 2001 17:25:55 +0200 (CEST)


Hi List,

At the moment I'm using this piece of code :

def parse_file(filepath) :
    from xml.sax.saxexts import make_parser
    p = make_parser()
    dh = MyParserHandler()
    p.setDocumentHandler(dh)
    p.parseFile(filepath)
    return dh.myObject

which does not deal with entities defined like this :

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE rootelement SYSTEM "MyOwn.dtd" [
	<!ENTITY tobeincluded.xml SYSTEM "tobeincluded.xml">
]>
<rootelement>&tobeincluded;</rootelement>

I search the archives and found out about :

	http://mail.python.org/pipermail/xml-sig/2001-July/005827.html

but I would rather keep a SAX interface instead of using ExpatReader...
and reading ExpatReader I'm not quite sure what piece of code to reuse !

Any advice ?

-- 
Nicolas Chauvat

http://www.logilab.com - "Mais oł est donc Ornicar ?" - LOGILAB, Paris (France)