xml-psychiatrist is an XML sanity checking/validation library written entirely in Common Lisp. It is still in version 0.4, so use it at your own risk. That said, it's a good XML validator.


There is a detailed manual at the project's web site.

Detailed description

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.


xml-psychiatrist is released by Peter Scott under the LLGPL. Share and enjoy!

ASDF-install package (obsolete) http://common-lisp.net/project/xml-psychiatrist/xml-psychiatrist-latest.tar.gz