W3C home > Mailing lists > Public > www-validator@w3.org > January 2004

Re: validating (x)html documents from the command line

From: Beton, Richard <richard.beton@roke.co.uk>
Date: Fri, 30 Jan 2004 16:13:02 +0000
To: Olav <olav@bogus.net>
Cc: www-validator@w3.org
Message-ID: <401A828E.2060105@roke.co.uk>

Olav wrote:

>is there any way to validate a html document from the unix or dos
>command line?
>(the objective is to check a lot of files in a flash without having to
>click buttons and selecting from file dialogs for each file)

I converted my site to XHTML and now I use Ant with the validate task to 
check all my files before I upload them.

Here's the relevant bits of my Ant buildfile:

<?xml version="1.0"?>
<project name="WHR Website" default="validate" basedir=".">

  <xmlcatalog id="commonDTDs">
         publicId="-//W3C//DTD XHTML 1.0 Strict//EN"
         publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"
         publicId="-//W3C//DTD XHTML Basic 1.0//EN"
         publicId="-//W3C//DTD XHTML 1.1//EN"
         publicId="-//WHR//DTD JINDEX 1.0//EN"
         publicId="-//WHR//DTD PAGE 1.0//EN"
         publicId="-//WHR//DTD JPAGE 1.0//EN"

=================================================================== -->

  <target name="validate"
          depends="xml.validate, xhtml.validate"
          description="=== Validates all XML and XHTML files against 
their DTD ===">


=================================================================== -->

  <target name="xml.validate"
          description="=== Validates all XML files against their DTD ===">

        <xmlcatalog refid="commonDTDs"/>
        <fileset dir="xdocs" includes="**/*.xml"/>


=================================================================== -->

  <target name="xhtml.validate"
          description="=== Validates all XHTML files against their DTD ===">

        <xmlcatalog refid="commonDTDs"/>
        <fileset dir="htdocs" includes="**/*.html"/>



Note that I have a local cache of DTDs to speed it up (in my htdocs/dtd 
folder).  I have three additional DTDs that I use to validate XML files 
of my own format - you can ignore these unless you also have XML source 
files, in which case you substitute your own.

I have a question too.  The Ant validate task is quite slow - monitoring 
tools suggest it does a lot of network i/o (presumably fetching DTDs 
etc).  Does anyone know of a way to speed this up, in addition to using 
a local XML catalogue.

Rick :-)

Registered Office: Roke Manor Research Ltd, Siemens House, Oldbury, Bracknell,
Berkshire. RG12 8FZ

The information contained in this e-mail and any attachments is confidential to
Roke Manor Research Ltd and must not be passed to any third party without
permission. This communication is for information only and shall not create or
change any contractual relationship.
Received on Friday, 30 January 2004 11:16:30 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:39 UTC