Home | Site Map | Site Search
Home > Information >

Do-it-yourself Offline HTML Validator

To create a simple, yet powerful offline HTML validator for Windows (95, 98 and NT2000 tested) one has to:

  1. Get a binary version of SP SGML parser for Windows 95 and NT.
  2. Unzip the downloaded SP to some directory, e.g. C:\Validator\SP
  3. Edit the following lines to correspond the directory where the SP package was installed. Save the results to some directory as validate40.bat.

    @echo off
    C:\Validator\SP\bin\nsgmls -s -c C:\Validator\SP\pubtext\html4.soc -c C:\Validator\SP\pubtext\html4.dcl -f %TEMP%\validation-results.txt %1
    start %TEMP%\validation-results.txt
  4. Add a shortcut to your SendTo folder:

    Windows 9x: Open C:\Windows\SendTo folder ->
    select File -> New Shortcut -> Browse (to a directory where validate40.bat file resides) ->
    Choose validate40.bat -> Open -> Next -> Select a name for the shortcut (Validate HTML 4.0, or something like that) -> Next -> Select an icon for the shortcut -> Finish .

    Windows NT2000/XP: Double-click My Computer ->
    Double-click the drive where Windows is installed (usually drive C, unless you have more than one drive on your computer) ->
    Double-click the "Documents and Settings" folder ->
    Double-click the folder of the user whose SendTo menu you want to change ->
    Double-click the SendTo folder (If the SendTo folder is not visible, on the Tools menu, click Folder Options, and then on the View tab, click Show hidden files and folders.) ->
    Select File -> New -> Shortcut ->
    Click Browse... (to a directory where validate40.bat file resides) and Choose validate40.bat -> Next Select a name for the shortcut (Validate HTML 4.0, or something like that) -> Finish ->
    In SendTo folder select the created shortcut, Click File -> Properties -> Change Icon. (You will get a warning saying that the bat file contains no icons. Just hit OK and select the icon from list) -> OK

  5. Test it! Right-click some HTML file -> Send To -> Validator. As a result Notepad (or some other application defined to open .txt documents) should pop up. If the file is a valid HTML 4.0 document, the editor shows an empty document. Otherwise it's filled with error messages.

    SP's error messages tend to be quite cryptic but usually they are informative enough to find the troublesome lines. Numbers like "3:12" indicate that there is something wrong in line 3, column 12.

    Do-it-yourself Offline HTML Validator in action

To validate documents against other DTDs, such as HTML 3.2 or XHTML 1.0, one must create a separate modified .bat file (something like validate32.bat, and validatexhtml1.bat) for each required DTD and follow the instructions given above. HTML 3.2 can be validated with the following modification to validate40.bat:

C:\Validator\SP\bin\nsgmls -s -c C:\Validator\SP\pubtext\HTML32.soc -c C:\Validator\SP\pubtext\HTML32.dcl -f %TEMP%\validation-results.txt %1

SP 1.3.4 comes with necessary files to validate HTML documents up to version 4.0. NSGMLS can fetch newer and custom DTDs automatically from the net, but to make the validation process faster and truly offline, it is advisable to install these DTD files permanently. To validate XHTML files, for example, one must download the suitable DTD from the W3C web site. In the case of XHTML 1.0 the necessary files are in xhtml1.zip. Unzip this file to some directory and copy all files in DTD directory into C:\Validator\SP\pubtext  . After these steps XHTML 1.0 documents can be validated with the following modification to validate40.bat:

C:\Validator\SP\bin\nsgmls -s -c C:\Validator\SP\pubtext\xhtml.soc -c C:\Validator\SP\pubtext\xhtml1.dcl -f %TEMP%\validation-results.txt %1

Home | Software | Information | Etsin | Chinese | Christmas Calendars | Site Info