import sys
from xml.parsers import expat
def start_element(name,attrs):
print 'Start:', name, attrs
def character_data(data):
print 'Data:', repr(data)
def end_element(name):
print 'End: ', name
p = expat.ParserCreate()
p.StartElementHandler = start_element
p.EndElementHandler = end_element
p.CharacterDataHandler = character_data
p.ParseFile(open(sys.argv[1]))
|