SAX-Based Analysis of the Guacamole Recipe : SAX : XML PYTHON examples


PYTHON examples » XML » SAX »

 

SAX-Based Analysis of the Guacamole Recipe


 

import sys
from xml.sax import saxutils
from xml.sax import make_parser

class SimpleHandler(saxutils.DefaultHandler):
    def startElement(self,name,attrs):
        print 'Start: ',name,attrs
    def endElement(self,name):
        print 'End: ',name
    def characters(self,data):
        print 'Data: ', repr(data)

parser = make_parser()
sh = SimpleHandler()
parser.setContentHandler(sh)
parser.parse(open(sys.argv[1]))

   
  



Leave a Comment / Note


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


PYTHON examples

 Navioo XML
» SAX