devtools/htmlparser.py
changeset 10588 fdaa0e4b7eaf
parent 10066 313ce53a7232
child 10618 3274a1648c7e
equal deleted inserted replaced
10587:72447be71b48 10588:fdaa0e4b7eaf
   165     def _parse(self, data):
   165     def _parse(self, data):
   166         inpsrc = sax.InputSource()
   166         inpsrc = sax.InputSource()
   167         inpsrc.setByteStream(StringIO(data))
   167         inpsrc.setByteStream(StringIO(data))
   168         try:
   168         try:
   169             self._parser.parse(inpsrc)
   169             self._parser.parse(inpsrc)
   170         except sax.SAXParseException, exc:
   170         except sax.SAXParseException as exc:
   171             new_exc = AssertionError(u'invalid document: %s' % exc)
   171             new_exc = AssertionError(u'invalid document: %s' % exc)
   172             new_exc.position = (exc._linenum, exc._colnum)
   172             new_exc.position = (exc._linenum, exc._colnum)
   173             raise new_exc
   173             raise new_exc
   174         return super(XMLSyntaxValidator, self)._parse(data)
   174         return super(XMLSyntaxValidator, self)._parse(data)
   175 
   175