4 from xml.sax import make_parser
5 from xml.sax.handler import ContentHandler
7 class parseXML(ContentHandler):
8 def __init__(self, attrlist):
9 self.isPointsElement, self.isReboundsElement = 0, 0
10 self.attrlist = attrlist
12 def startElement(self, name, attrs):
13 if (attrs.has_key('text')):
14 attrlist[attrs.get('text', "")] = "foo"
15 if (attrs.has_key('title')):
16 attrlist[attrs.get('title', "")] = "foo"
18 parser = make_parser()
22 contentHandler = parseXML(attrlist)
23 parser.setContentHandler(contentHandler)
25 dir = os.listdir(sys.argv[1])
27 if (str(x[-4:]) == ".xml"):
28 parser.parse(sys.argv[1] + str(x))
30 #parser.parse(sys.argv[1])
32 for k, v in attrlist.items():
34 print '#: ' + sys.argv[1]
35 print 'msgid "' + str(k) + '"'