1.1 --- a/libxml2dom/errors.py Tue Aug 26 00:34:42 2008 +0200
1.2 +++ b/libxml2dom/errors.py Thu Aug 28 23:35:07 2008 +0200
1.3 @@ -40,6 +40,6 @@
1.4 return "DOMError(%d, %r, %r)" % (self.severity, self.message, self.type)
1.5
1.6 def __str__(self):
1.7 - return repr(self)
1.8 + return "DOMError: %s" % self.message
1.9
1.10 # vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/libxml2dom/macrolib/macrolib.py Tue Aug 26 00:34:42 2008 +0200
2.2 +++ b/libxml2dom/macrolib/macrolib.py Thu Aug 28 23:35:07 2008 +0200
2.3 @@ -537,9 +537,9 @@
2.4 def __str__(self):
2.5 exctype, excdata = self.args[0:2]
2.6 if exctype == self.PARSE_ERR:
2.7 - return "Parse error: %r" % self
2.8 + return "Parse error: %s" % excdata
2.9 elif exctype == self.SERIALIZE_ERR:
2.10 - return "Serialize error: %r" % self
2.11 + return "Serialize error: %s" % excdata
2.12 else:
2.13 return repr(self)
2.14
2.15 @@ -606,8 +606,17 @@
2.16
2.17 # NOTE: May not be the correct exception.
2.18
2.19 + error = libxml2mod.xmlGetLastError()
2.20 + if error is not None:
2.21 + filename = libxml2mod.xmlErrorGetFile(error)
2.22 + line = libxml2mod.xmlErrorGetLine(error)
2.23 + error_message = libxml2mod.xmlErrorGetMessage(error).strip()
2.24 + message = "Filename %r, line %d: %s" % (filename, line, error_message)
2.25 + else:
2.26 + message = "Document did not validate"
2.27 +
2.28 raise LSException(LSException.PARSE_ERR,
2.29 - DOMError(DOMError.SEVERITY_FATAL_ERROR, "Document did not validate"))
2.30 + DOMError(DOMError.SEVERITY_FATAL_ERROR, message))
2.31
2.32 elif unfinished or Parser_well_formed(context):
2.33 return doc
3.1 --- a/tests/test_invalid.xml Tue Aug 26 00:34:42 2008 +0200
3.2 +++ b/tests/test_invalid.xml Thu Aug 28 23:35:07 2008 +0200
3.3 @@ -1,5 +1,7 @@
3.4 <?xml version="1.0"?>
3.5 <!DOCTYPE zoo [
3.6 + <!ELEMENT zoo (cage*)>
3.7 + <!ELEMENT cage (#PCDATA)>
3.8 <!ATTLIST cage
3.9 id ID #IMPLIED
3.10 description CDATA #REQUIRED
4.1 --- a/tests/test_valid.xml Tue Aug 26 00:34:42 2008 +0200
4.2 +++ b/tests/test_valid.xml Thu Aug 28 23:35:07 2008 +0200
4.3 @@ -1,5 +1,7 @@
4.4 <?xml version="1.0"?>
4.5 <!DOCTYPE zoo [
4.6 + <!ELEMENT zoo (cage*)>
4.7 + <!ELEMENT cage (#PCDATA)>
4.8 <!ATTLIST cage
4.9 id ID #IMPLIED
4.10 >