On Oct 2, 3:32 pm, hrishy <[EMAIL PROTECTED]> wrote:
> Hi
>
> Does anybody have a python xample program to validate a xml file against a 
> XSD.
>
> regards
> Hrisy

I have used minixsv successfully in a test environment -

http://www.familieleuthe.de/MiniXsv.html

Here is some sample code -

#---------------------------------
from minixsv import pyxsval as xsv
try:
    etw = xsv.parseAndValidateXmlInput(
        'bpmn1.xml',
        'bpmn.xsd',
        xmlIfClass=xsv.XMLIF_ELEMENTTREE)
    et = etw.getTree()
    root = et.getroot()
except xsv.XsvalError,errstr:
    print errstr
#---------------------------------

It supports minidom, 4DOM, and ElementTree.

It is written in pure python. It is not very fast - around 0.5 sec for
a small xml file - but I have not compared it with any others, so I
don't know what is typical.

I believe that lxml also handles xsd files, but I have not tried it,
so I can't give any details.

HTH

Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to