Validating Mallard XML and mallard-rng

If you are writing Mallard docs, it is a good idea to validate your XML. Yelp will sometimes render invalid markup (such as sections without id’s and title tags) without alerting you to the invalidity. First you will need the right tool. That is the yelp-tools package.

If you are running Fedora, you can install this using yum:

$ sudo yum install yelp-tools

Now that you have the tools for the job, cd into the directory containing all your .page files (usually a directory called C).

In order to validate a particular page:

$ yelp-check validate <filename>.page

To validate all the .page files you can type:

$ yelp-check validate *.page

If everything is fine, you will simply get the command prompt back with no output, otherwise there will be some error messages you will need to sift through and correct.

The catch is that you must be connected to the internet for this to work, and projectmallard.org must be up. Usually this is not a problem, however, being able to run this locally is not only faster, but allows you to not worry about connectivity or the site being available.

In order for this tool to function locally, you first must have yelp-tools and yelp-xsl-devel installed from your package manager. Then follow these steps:

$ cd

$ git clone git://gitorious.org/projectmallard/mallard-site-tool.git

$ cd ~/mallard-site tool

$ ./autogen.sh —prefix=/usr —sysconfdir=/etc

$ sudo make install

$ cd

$ git clone git://gitorious.org/projectmallard/projectmallard.git

$ cd ~/projectmallard

$ mallard-site-tool cache

$ cd ~/projectmallard/download/mallard-rng

$ ./autogen.sh —prefix=/usr —sysconfdir=/etc

$ sudo make install

Now you are all set up to validate all your pages, anytime, anywhere :-)

For those interested: yelp-check validate uses the RNG schemas, and references them by their canonical URI on projectmallard.org. The mallard-rng package provides local copies of those schemas, along with an XML catalog file that instructs libxml2 to use the local copy when the remote URI is requested.

Thanks to Shaun McCance for this info!

Blog comments powered by Disqus