473,320 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Sample code required to validate a xml file against XSD

Hi

Does anybody have a python xample program to validate a xml file against a XSD.

regards
Hrisy

Oct 2 '08 #1
2 3416
On Oct 2, 7:32*am, hrishy <hris...@yahoo.co.ukwrote:
Hi

Does anybody have a python xample program to validate a xml file against a XSD.

regards
Hrisy
I just googled "python validate a xml file against XSD" and found
this:

http://mail.python.org/pipermail/xml...ch/009244.html

hope it helps.

Daniel
Oct 2 '08 #2
On Oct 2, 3:32*pm, hrishy <hris...@yahoo.co.ukwrote:
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
Oct 3 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Leona | last post by:
Hello all, does anyone know of a tool, preferably free, preferably on linux, which will take an xml file and validate it against your own custom W3C XML Schema file (.xsd) ?? All help...
1
by: Ron Rohrssen | last post by:
I've been working on learning XML schemas and trying to make use of the MS classes for validating data against a schema. So, I've been trying to work through some simple schemas and instances....
6
by: Daniel Rimmelzwaan | last post by:
I want to send a biztalk document to an aspx page, and I need to see some sample code, because I just can't make it work. I have a port with transport type HTTP, pointing to my aspx page, something...
7
by: Ali-R | last post by:
Hi all, I am getting a CSV file like this from our client: "C1","2","12344","Mr","John","Chan","05/07/1976"......... I need to validate **each filed value** against a set of rules ,for...
4
by: Mr. x | last post by:
Hello, I know about the validator on : http://validator.w3.org , which can validate html pages. I just new to this validator. How can I validate (if it can be - by this validator) aspx pages,...
4
by: Scott Lezberg \(Deltek\) | last post by:
Does anyone have some sample code that can validate a domain username and password account to check to see if it is a valid account? Thanks in advance. Scott
3
by: Rushi | last post by:
Hi All, Is it possible to Validate XML against XSD using two different XML files. scenario: There are two different XML file, one file contain element and count information and other one...
4
by: ss | last post by:
hi, can anybody gives me a sample code where the sql injection attack is validated. how can i do that in business logic layer and pass the error to the presentation tier I want the sample...
0
by: delphiconsultingguy | last post by:
Hi all, Spent WAAAYYY too much time trying to figure this out because there's not many good examples out there, so in the interest of sparing y'all from suff'rin same, I've pasted it into...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.