where have the diagnostics of ExtraContentError gone?
Brought to you by:
pabigot
doc = aaa.CreateFromDocument(open("zzz.xml").read())
Traceback (most recent call last):
...
File "/usr/lib/python2.7/site-packages/pyxb/binding/basis.py", line 2077, in append
raise pyxb.ExtraContentError('%s: Extra content %s starting with %s' % (self.ExpandedName, element_binding, value,))
pyxb.exceptions.ExtraContentError
>>>
Hmm...%s is what?
I hope StructuralBadDocumentError don't eat *args:
class StructuralBadDocumentError (BadDocumentError):
#...
def __init__ (self, *args, **kw):
#...
BadDocumentError.__init__(self, **kw)
but I hope:
def __init__ (self, *args, **kw):
#...
BadDocumentError.__init__(self, *args, **kw)
#_______________________________^^^^^^
Is this your intent?
(Maybe this ticket relates #26)
Yes, probably adding *args into that exception would help pass the location information along. If you make that change, does it help? If so I can put it in 1.1.15.
PyXB's diagnostics are horrible. I'm actively working a complete replacement to the content model which will address #112 and at the same time make huge improvements to the diagnostics. The entire exception hierarchy will be reviewed after that finishes. This will be made available in PyXB 1.2.0, which I hope will be in the next couple weeks.
Yes. Even if it is "horrible", it will be much better than nothing.
I don't know your roadmap from 1.1.5 to 1.2.0, but it's not bad to apply
as temporary solution in 1.1.5, I think so.
commit 5cdb7ac2dc2c697247d594d3cb64945f7b6e1398
Author: Peter A. Bigot <pab@‌>
Date: Thu Aug 30 03:39:07 2012 -0500