Structure of a Program to Process a Document with a _DTD Using SAX : SAX : XML PYTHON examples


PYTHON examples » XML » SAX »

 

Structure of a Program to Process a Document with a _DTD Using SAX


 

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])

   
  



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo XML
» SAX