import sys
from xml.sax import make_parser
from xml.sax import handler
class SimpleDTD(handler.DTDHandler):
def notationDecl(self,name,publicid,systemid):
print "notationDecl: ", name, publicid, systemid
def unparsedEntityDecl(self,name,publicid,systemid,ndata):
print "unparsedEntityDecl: ", name, publicid, systemid, ndata
p = make_parser()
p.setDTDHandler(SimpleDTD())
p.parse(sys.argv[1])
|