Here’s a simple starter for hacking on the Feed Validator, either to make fixes, or simply to use it for non-public feeds.

(This is for Linux – tips for Windows or other environments are welcome!)

Get the code

The Feed Validator doesn’t make official releases, but it’s regularly updated and a current snapshot is almost always stable. Choose a local directory to store the validator in – say, ~/feedvalidator.

Download a snapshot

Snapshots are available from https://github.com/rubys/feedvalidator/archives/master.

Or, use Git

Git is slightly more complicated to get working, but then you can keep current.

git clone git://github.com/rubys/feedvalidator.git

Later, to get the latest code, call git pull from inside the feedvalidator directory. See the Git documentation for more information.

Run it from the command line

There's a command-line interface:

python src/demo.py <feed url>

(Or, hack that script to work how you want.)

Set it up for your web server

First install a web server, Python and additional character encoding support. Under Debian:

apt-get install apache2-mpm-worker python2.3 python2.3-iconvcodec

Standard Method

For simplicity, it’s easiest to run the validator out of a regular user account. That means you don't need to be root.

To do this, simply unpack or check out the Feed Validator into your public_html directory. Now open a browser to http://localhost/~<your usercode>/feedvalidator/check.cgi and we’re, hopefully, done.

Do you have special requirements?

If you have special requirements for things like where directories are to be placed, you may want to tweak the config.py file. For example, if you want to separate the code, the cgi, the docs, and css files, you copy/link to only the files you need:

FVDIR=<location of the feedvalidator directory>
cd ~/public_html
ln -s "$FVDIR/css" fv-css
ln -s "$FVDIR/docs" fv-docs
mkdir -p cgi-bin/fv
cp "$FVDIR/check.cgi" "$FVDIR/config.py" cgi-bin/fv/

Now, tweak config.py to point to the other directories:

WEBDIR = '/'.join(os.environ['SCRIPT_FILENAME'].split('/')[0:-1])
WEBDIR = '/home/<your usercode>/feedvalidator'

DOCSURL='docs'
CSSURL='css'
DOCSURL='../../fv-docs'
CSSURL='../../fv-css'

Great!

Now open a browser to http://localhost/~<your usercode>/cgi-bin/fv/check.cgi.

Running tests

I don’t think it’s any disrespect to say that that the test cases are the Validator’s most valuable asset – currently over fourteen hundred separate cases of valid, and invalid, feeds, along with the precise errors. When you find a bug, or any other misfeature, a simple test case is the best way to get your point across.

To check the existing cases, run python src/validtest.py. This will check everything below the ‘testcases’ directory (you can also specify a single test by filename).

Not clear? Suggestions or improvements?

Let us know on the feedvalidator-users discussion list!

This documentation page was last updated on July 9, 2011.

Copyright © 2002-6 Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda