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
Nightly snapshots are available from http://feedvalidator.org/download/.
Or, use CVS
CVS is slightly more complicated to get working, but then you can keep current.
cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/feedvalidator login (No password; hit return.) cvs -z3 -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/feedvalidator checkout feedvalidator
Later, to get the latest code, call cvs up from inside the
feedvalidator directory.
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
For simplicity, it’s easiest to run the validator out of a regular user account. That means you don't need to be root.
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 = HOMEDIR + r'/public_html/feedvalidator'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 and we’re, hopefully, done.
Running tests
I don’t think it’s any disrespect to say that that 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!