Structure of a Program to Process a Document with a _DTD Using SAX,_dtdsax,import sysfr


import sysfrom xml.sax import make_parserfrom xml.sax import handlerclass 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])

评论关闭