Hi *,
On 8/28/07, Matthias Mueller-Prove <[EMAIL PROTECTED]> wrote:
> ok - let's see - the validator says "we" have 45 errors...
Validating pages is a tedious task when you need to use a web-based validator.
But you can ease your life when using a local validator. Some plugins for
browsers have already be mentioned, here's another one: xmllint it is
useful on its
own already, but it can be done even more comfortably in combination with vim
(well, aleays depends on what you're used to :-)
vim has a "quickfix" mode that can be used with xmllint as well.
You can set the makeprogram to xmllint instead and consequently have the
errors xmllint fines in your quickfix window. (If you don't know what
this all is
about, then you probably won't like this method :-)) - but if you're a vim user
already, type :help quickfix or read the introduction in the vim user
guide (in my
version chapter 30.1 thus you can try :help 30.1 as well)
Thinks you'd need: xmllint and a local set of the XHTML-dtds, and vim
You could use the following as ~/.vim/compiler/xmllint.vim
if exists("current_compiler")
finish
endif
let current_compiler = "xmllint"
setlocal makeprg=xmllint\ --valid\ --noout\ %
setlocal errorformat=%f:%l:\ %m
- or if you want for force it to a variant instead of reading it from
the file itself:
setlocal makeprg=xmllint\ --valid\ --dtdvalidfpi\ '-//W3C//DTD\ XHTML\
1.0\ Strict//EN'\ --noout\ %
for strict and
setlocal makeprg=xmllint\ --valid\ --dtdvalidfpi\ '-//W3C//DTD\ XHTML\
1.0\ Transitional//EN'\ --noout\ %
for transitional
I saved three variants (xmllint.vim and xmllint-strict.vim and
xmllint-transitional.vim)
You can now use it within vim by setting the makeprogram to your new file
:set makeprg=xmllint
If you now type :make it will validate your file and you can use the
quickfix commands
to jump to the errors or list them
Since setting the makeprogram manually is annoying at best, you can add that
command to your filtetypeplugins
my ~/.vim/ftplugin/html.im contains
compiler xmllint
Note on the local DTDs: In case you don't have it setup already by
your distribution,
you can download the dtds from the w3c site (included in
http://validator.w3.org/sgml-lib.tar.gz ) adding the following to
/etc/xml/catalog should
then do the trick:
<public publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"
uri="file:///home/cl/Documents/dtds/xhtml1-transitional.dtd"/>
<public publicId="-//W3C//DTD XHTML 1.0 Strict//EN"
uri="file:///home/cl/Documents/dtds/xhtml1-strict.dtd"/>
(of course adapt the path to match your setup)
I'm sure this confused quite a bit of people, but maybe others will
find it useful.
Those who don't like vim can just use xmllint standalone or maybe integrate it
into their editor with similar constructs
ciao
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]