idea: todo: improve amara’s scimitar api

First of all, if you haven’t seen amara yet, go check out amara today and stick it in your toolbox. It’s a very very nice library for python that lets you create objects out of XML documents. One of the nifty things amara provides, it scimitar, which is an implementation of schematron, a rich schema language. Schematron allows you to validate documents via using contexts, rules, and assertions written in xpath about the document. Schematron allows you to create a document which will validate your XML document, and as a side effect, create a schema for that XML. Very nice!

In addition, schematron allows you to include rich and detailed reports on what is wrong and right with the document. This means I’ll be able to inform my users of the exact problems in the XML they offered, instead of just telling them it’s wrong! Better user experience always wins in my book. Anyway, the interface to scimitar is a bit crude at the moment. Currently, you create a schematron document, run scimitar over it, which then produces an automatically generated python script. When you run the script on the command line, it’ll validate the document you give as an argument, and produce the report for you. However, I’d like to get access at this programmatically. I’ve been looking through some of the source, and there isn’t an API that directly allows you to do processing and sniff for the errors. Currently, I’d have to parse the output myself, and I hate writing code that does that.

So perhaps at the end of the month, I’ll take a brief stab at producing some API access to schematron processing using scimitar. If I ever get around to it, I’d obviously contribute it back to the project. Thanks for the wonderful code, Uche!


Post a Comment

Required fields are marked *

%d bloggers like this: