RNVDownload RNV, ARX and RVP from http://ftp.davidashen.net/PreTI/RNV/. ARX and RVP are parts of RNV distribution. A short description is at http://ftp.davidashen.net/PreTI/RNV/readme.txt. RNV is an implementation of Relax NG Compact Syntax validator in ANSI C. The command-line utility uses Expat. It is distributed under BSD license. The validator is a by-product of my work on authoring tools for marked-up documents. While it was written to polish techniques and approaches, it is fast, can work with limited memory footprint and has good and flexible error reporting. XML Schema datatypes have been implemented to make it even more usable. Expat is the only external library it relies on (besides ANSI C), everything else is inside. ARX is a tool to automatically determine the type of a document from its name and contents. It is inspired by James Clark's schema location approach for nXML, http://groups.yahoo.com/group/emacs-nxml-mode/message/259, and is a development of the idea described in http://relaxng.org/pipermail/relaxng-user/2003-December/000214.html. Here is a sample configuration for ARX: grammars { docbook="docbook.rnc" xslt="xslt.rnc" xslfo="fo.rnc" } valid { start = element (book|article|chapter|reference) {any} any = (element * {any}|attribute * {text}|text)* } => docbook !valid { default namespace xsl = "http://www.w3.org/1999/XSL/Transform" start = element *-xsl:* {not-xsl} not-xsl = (element *-xsl:* {not-xsl}|attribute * {text}|text)* } => xslt =~/.*\.xsl/ => xslt =~/.*\.fo/ => xslfo RVP is abbreviation for Relax NG Validation Pipe. It reads validation primitives from the standard input and reports result to the standard output; it's main purpose is to ease embedding of a Relax NG validator into various languages and environment. An apllication would launch RVP as a parallel process and use a simple protocol to perform validation. To assist embedding RVP, samples in Perl and Python are provided. The scripts use Expat wrappers for each of the languages to parse documents; they take a Relax NG grammar (in the compact syntax) as the command line argument and read the XML from the standard input.The scripts are kept simple and unobscured to illustrate the technique, rather than being designed as general-purpose modules. Programmers using Perl, Python, Ruby and other languages are encouraged to implement and share reusable RVP-based components for their languages of choice. Besides built-in support for XML Schema datatypes, RNV provides two different ways to add user-defined datatype libraries. A custom datatype checker can be implemented as an external command. The command is specified as a parameter for RNV, and executed for each datatype check; the type name and parameters are passed as command-line arguments to the command. Another way is to use the built-in Scheme interpeter (SCM, http://www.swiss.ai.mit.edu/~jaffer/SCM.html) to implement the library in Scheme, a dialect of Lisp. This solution is more flexible and robust than the previous one, but requires knowledge of a particular programming language (or at least desire to learn it, and the result is definitely worth the effort). | |