hi,

i've just installed pyxb-1.2.3 into python-2.7
(via macports) on macosx-10.6.8 to validate xml
documents against an xsd file but the validation
errors that i'm seeing are not the nice informative
ones as described in:

  http://pyxb.sourceforge.net/userref_validating.html

instead of seeing line/column numbers and element names,
i'm seeing:

  pyxb.exceptions_.SimpleFacetValueError:
  Type <class 'sampleschema.STD_ANON_12'> minLength constraint violated by value

btw, the code supplied in the url above assumes that the exception
will be pyxb.UnrecognizedContentError but pyxb.exceptions_.SimpleFacetValueError
doesn't seem to be a subclass of that.

any idea what i've done wrong?

i generated the module with:

  $ pyxbgen -u sample-schema.xsd -m sampleschema
  Python for AbsentNamespace0 requires 1 modules

and the client code is:

  import sys, pyxb, sampleschema
  if len(sys.argv) != 2:
      print('usage: %s sample.xml' % sys.argv[0])
      exit(0)
  xmlbytes = open(sys.argv[1]).read()
  xmlparsed = None
  try:
      xmlparsed = sampleschema.CreateFromDocument(xmlbytes)
  except pyxb.UnrecognizedContentError as e:
      print('Error validating XML\n%s' % e.details())
  except Exception as e:
      print('Unknown XML validation error\n%s\n%s' % (type(e), e.details()))

which outputs:

  Unknown XML validation error
  <class 'pyxb.exceptions_.SimpleFacetValueError'>
  Type <class 'sampleschema.STD_ANON_12'> minLength constraint violated by 
value 

also, am i right in thinkng that there is no way to obtain
a list of all validation errors in a document (like xmllint)?

thanks,
raf


------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
pyxb-users mailing list
pyxb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyxb-users

Reply via email to