xml-psychiatrist

A powerful XML sanity checker

Introduction

Despite the ambivalent feelings of some people, XML is taking over the world. More and more, programs have to take XML files as input. However, this presents us with a problem: error checking. How can we be sure that the information in the XML document isn't junk? We could include a lot of error checking in our XML processing code, but that complicates things considerably and is prone to bugs. Ideally, we would like to separate out the sanity checking machinery. How should we do that?

We could use a Document Type Definition, or DTD. Unfortunately, DTDs have a verbose, clunky syntax, and they can't say anything about the information in the document. They can specify the structure, but they can't see past it. Also, DTDs don't support namespaces.

We could use an XML Schema. They support some content type checking, but they, too, have problems. They are written in XML, which is both a blessing and a curse. It's a blessing because XML is easy to parse; it's a curse because the format is so verbose that your fingers will ache with pain and you will get carpal tunnel syndrome if you type too much of it. Also, it lacks some more powerful and dangerous features, such as full use of Common Lisp in the validation process. Schemas and DTDs both share the disadvantage that they aren't part of Lisp, and are not designed to be used from Lisp processes.

I wanted to do some sanity checking on XML documents from a Common Lisp program I'm writing. I didn't want to use DTDs or Schemas for the reasons above. I wanted to be able to write the specifications for XML structures in a lispy syntax. I wanted enough power to grow. So, I wrote xml-psychiatrist. It is released under the LLGPL.

Mailing Lists

Documentation

There is a decent manual available.

View online

Download PDF

Download PostScript

Download

You can get xml-psychiatrist via asdf-install. Alternately, you can download it from here:

Download xml-psychiatrist 0.3 (PGP Signature)

Valid XHTML 1.0 Strict