Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

minixsv (via) As far as I can tell, this is the only library that can validate XML using pure Python (no C extension required). I’d be extremely happy if someone would write a pure Python library (or one that only depends on ElementTree, which is included in the standard library) for validating XML against a Relax NG Compact syntax schema. Even DTD validation would be better than nothing!

Tagged , , , , , ,

1 comment

  1. Unfortunately it's entirely undocumented - here's how I got it to work:

    from minixsv.pyxsval import parseAndValidate
    try:
        parseAndValidate('shiporder.xml', 'shiporder.xsl')
    except XsvalError, e:
        print e.args[0]
    

    The resulting exception is just a plain string rather than a more useful data structure - it looks like this: u"ERROR: shiporder.xsd: line 19: Unexpected or invalid child tag (u'http://www.w3.org/2001/XMLSchema', u'compl3xType') found in tag (u'http://www.w3.org/2001/XMLSchema', u'element')!"

    Simon Willison - 12th August 2009 17:05 - #

Comments are closed.
A django site