[XML-SIG] handle drv_xmlproc_val SAXParseExceptions

Remy C. Cool dev-xml@smartology.nl
Thu, 5 Dec 2002 22:23:36 +0100


Commenting out the lines that appends the error/warning to the list so 
that only the print exception statements remains did not change 
anything. 

Trace:

Traceback (most recent call last):
  File "./xpdf.py", line 253, in ?
    produce_pdf = main(basedir.xpdf + xpdf_file)
  File "./xpdf.py", line 246, in __init__
    parser.parse(xpdf_file)
  File "/usr/lib/python2.1/site-packages/_xmlplus/sax/xmlreader.py", 
line 123, in parse
    self.feed(buffer)
  File 
"/usr/lib/python2.1/site-packages/_xmlplus/sax/drivers2/drv_xmlproc.py", 
line 93, in feed
    self._parser.feed(data)
  File 
"/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlval.py", 
line 44, in feed
    self.parser.feed(data)
  File 
"/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlutils.py", 
line 329, in feed
    self.do_parse()
  File 
"/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlproc.py", 
line 93, in do_parse
    self.parse_start_tag()
  File 
"/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlproc.py", 
line 197, in parse_start_tag
    self.app.handle_start_tag(name,attrs)
  File 
"/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlval.py", 
line 203, in handle_start_tag
    self.parser.report_error(2003, name)
  File 
"/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlproc.py", 
line 63, in report_error
    EntityParser.report_error(self,number,args)
  File 
"/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlutils.py", 
line 519, in report_error
    self.err.error(msg)
  File 
"/usr/lib/python2.1/site-packages/_xmlplus/sax/drivers2/drv_xmlproc.py", 
line 223, in error
    self._err_handler.error(saxlib.SAXParseException(msg, None, self))
TypeError: object of type 'list' is not callable



On Thursday 05 December 2002 22:19, Remy C. Cool wrote:
> I've double checked that part, but it was a long day today so I
> could have overlooked something.
>
> This is my __init__ :
>
> def __init__(self):
>
>       # containers
>       self.warning = []
>       self.error = []
>
>       # flags
>       self.is_inside_template_tag = 0
>       self.description = ''
>       self.is_inside_description_tag = 0
>
> The self.warning and self.error lists are declared, so that's not
> the problem. I'll run some tests on that.
>
> Regards,
> Remy
>
> On Thursday 05 December 2002 22:11, Martin v. L÷wis wrote:
> > "Remy C. Cool" <dev-xml@smartology.nl> writes:
> > > This is SAX2 correct ?
> >
> > Yes, it looks right
> >
> > > I also 'fixed' the DTD and the DTD warnings are gone ... but
> > > the TypeError remains.
> >
> > Perhaps you just look closely at the exception :-)
> >
> > self.err_handler.warning(saxlib.SAXParseException(msg,None,self))
> > TypeError: object of type 'list' is not callable
> >
> > and in the handler you write
> >
> >    def warning(self, exception):
> >       	# warning ... record
> >       	self.warning.append(exception)
> >       	print exception
> >
> > I *think* you have ommitted some essential part, e.g.
> >
> >    def __init__(self):
> >         self.warning = []
> >
> > What do you think self.err_handler.warning is after that
> > initialization?
> >
> > Regards,
> > Martin
> >
> > _______________________________________________
> > XML-SIG maillist  -  XML-SIG@python.org
> > http://mail.python.org/mailman/listinfo/xml-sig
>
> _______________________________________________
> XML-SIG maillist  -  XML-SIG@python.org
> http://mail.python.org/mailman/listinfo/xml-sig