That did it!!! Thanks so much!! On Friday, January 25, 2013, Ed Caspersen wrote:
> try passing the instance instead of the class to setContentHandler > > parser.setContentHandler(xmlHandler()) > > Ed Caspersen > > > On Fri, Jan 25, 2013 at 8:26 AM, Dillon Bailey > <[email protected]<javascript:_e({}, 'cvml', '[email protected]');> > > wrote: > >> Here is the error: >> >> Error: TypeError: unbound method setDocumentLocator() must be called >> with xmlHandler instance as first argument (got ExpatLocator instance >> instead) # >> >> >> Here is my code: >> >> >> import xml.sax as Sax >> from xml.sax import ContentHandler, SAXParseException >> from xml.sax import make_parser >> >> class xmlHandler(ContentHandler): >> >> def __init__(self): >> self.vehicles = [] >> self.desc = False >> >> def startElement(self, name, attrs): >> if name == 'vehicle': >> print 'vehicle' + str(attrs.get('name',"N/A")) >> >> >> def characters(self, ch): >> if self.desc: >> print ch >> >> def endElement(self, name): >> if name == 'description': >> self.desc = False >> print '\n' >> >> parser = make_parser() >> parser.setContentHandler(xmlHandler) >> parser.parse('C:\\20130124.xml') >> >> >> Any thoughts what I am doing wrong? >> >> Thanks, >> Dillon Bailey >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To post to this group, send email to >> [email protected]<javascript:_e({}, 'cvml', >> '[email protected]');> >> . >> To unsubscribe from this group, send email to >> [email protected] <javascript:_e({}, >> 'cvml', 'python_inside_maya%[email protected]');>. >> >> >> > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]<javascript:_e({}, > 'cvml', > 'python_inside_maya%[email protected]');>. > To post to this group, send email to > [email protected]<javascript:_e({}, 'cvml', > '[email protected]');> > . > > > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected].
