validating XML

andrea crotti andrea.crotti.0 at gmail.com
Wed Jun 13 06:06:03 EDT 2012


Hello Python friends, I have to validate some xml files against some xsd
schema files, but I can't use any cool library as libxml unfortunately.

A Python-only validator might be also fine, but all the projects I've
seen are partial or seem dead..

So since we define the schema ourselves, I was allowed to only implement
the parts of the huge XML definition that we actually need.

Now I'm not quite sure how to do the validation myself, any suggestions?

I thought that I could first parse and store in memory the schema, then
iterate over the XML I need to validate and do the needed sanity checks
there.

So I might use or minidom.parse or ElementTree.parse, which both look
fine even if I'm not sure which one is more suitable.

Another thing is that I would like to be able that if the schema changes
my validation is still correct, so I would need some sort of meta-schema
that declares all the XML constructs that I'm allowed to use.

Anyone did something like this?
Thanks,
Andrea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120613/5c79404d/attachment.html>


More information about the Python-list mailing list