Site navigation below

In this section

Place your text ad here.

Data recovery software tools & file recovery utilities to recover lost data

WestNIC provides reliable web hosting services

SSL Certificates for ecommerce secure servers.

Advance Linux Recovery and Windows Partition Recovery Software

Computer software and software downloads resources

Download best data backup and data security software

Top freeware software and system shareware utilities to download

Recover emails using pst repair and dbx recovery tool

The NSGMLS program is the SGML parser that sits behind the W3C and Web Design Group's online validators. To save time online, NSGMLS can easily be installed on a Windows workstation and integrated with most standard markup editors to check your HTML or XHTML as you go. This article explains how.

Extract the SP package

Extract the SP package to a directory with a short path and no spaces, such as C:\sp; this will make configuration slightly simpler. The SP package includes a main sp directory and three sub-directories:

bin
The program files, including nsgmls.exe.
doc
The package documentation (see nsgmls.htm for further details).
pubtext
The DTDs, entity sets, SGML declarations and Open Catalog files for a range of HTML versions. The standard distribution does not include the XHTML files.

Extract the XHTML file set

The W3C zip archive includes three DTDs for Strict, Transitional and Frameset document types, and the relevant entity sets, SGML declarations and Open Catalog files for XHTML. Extract all these files to the SP pubtext directory for convenience, to keep them with their HTML equivalents.

The key arguments

NSGMLS is purely a command line program that may be passed a range of runtime arguments, a full listing is included in the package documentation. The two key parameters are the path to the program itself and the file to parse. For HTML validation, the following arguments will likely be useful too:

-c

This case sensitive argument specifies a file that is essentially a pointer to the relevant SGML Open Catalog file in the pubtext directory. The catalog entry file maps the PUBLIC identifier given in a Document Type Declaration to local copies of the Document Type Definition in the pubtext directory. The syntax is to follow the argument directly with the system identifier for the catalog file, e.g.

C:\sp\bin\nsgmls.exe -cC:\sp\HTML4.txt
          

For HTML 4 validation, the contents of the HTML4.txt file would be a single line that refers to the HTML 4 Open Catalog file:

CATALOG pubtext/html4.soc
          
-s

This argument suppresses the output of the source markup and only lists the errors, e.g.

C:\sp\bin\nsgmls.exe -s c:\source\MyMarkup.htm
          
-E

This argument limits the output to a specified number of errors, e.g. the first 5 errors only:

C:\sp\bin\nsgmls.exe -E5 c:\source\MyMarkup.htm
          

Example configuration

A complete validation command for XHTML 1.0 may be constructed as follows:

C:\sp\bin\nsgmls.exe -cC:\sp\XHTML1.txt -s -E10 c:\source\MyMarkup.htm
      

This parse would use the XHTML catalog entry file, suppress the output of the original markup and only list the first 10 errors in the file MyMarkup.htm.

Your documents will need to have a suitable Document Type Declaration to match those specified in the relevant SGML Open Catalog file (.soc). See the HTML and XHTML recommendations for more details.

Integrating NSGMLS with markup editors

NSGMLS can be run directly from the system shell using the commands outlined above. However, any good text or markup editor should have the facility to run such programs directly on the current file. The examples below show how to set up NSGMLS with EditPlus, TextPad and UltraEdit for Windows. These cases should indicate how to make equivalent settings in your own development environment.

In all cases, the NSGMLS validation is run on the file that is currently selected in the editor window. Bear in mind that with the -s argument, NSGMLS will not produce any output if your markup is valid. Use the -E argument to limit the number of errors listed.

NSGMLS set up for EditPlus

The EditPlus text editor is available at http://www.editplus.com/.

  1. Select Tools > Cconfigure user tools..., activate the Group Name... button and add a label for the program group.
  2. Activate the Add Tool button and select the Program option.
  3. Insert the cursor in the Menu text field and add a label for the tool.
  4. Select the button alongside the Command field to browse and select the nsgmls.exe program in the bin directory.
  5. Command program selected.
  6. Insert the cursor in the Argument field and enter the NSGMLS arguments, use the selector alongside to add the $(FilePath) parameter for the current file.
  7. Check the Capture output box. This option will list the validation results in the editor window.

This validation option can be accessed via the Tools menu and will have a keyboard shortcut assigned.

NSGMLS set up for TextPad

The TextPad text editor is available at http://www.textpad.com/.

  1. Select Configure > Preferences... > Tools, activate the Add button and choose Program.
  2. Browse and select the nsgmls.exe program in the bin directory.
  3. Select the program entry to add a label to the tool.
  4. Insert the cursor in the Parameters field and enter the NSGMLS arguments, use the $File parameter to specify the current file.

TextPad applies output capture settings by default to list the validation results in the editor window. The new validation option can be accessed via The Tools menu and will have a keyboard shortcut assigned.

NSGMLS set up for UltraEdit

The UltraEdit text editor is available at http://www.ultraedit.com/.

  1. Select Advanced > Tool cofiguration... to access the Tool Configuration dialogue.
  2. Activate the Browse button alongside the Command line field to browse and select the nsgmls.exe program in the bin directory.
  3. Command program selected.
  4. Insert the cursor in the Command line field after the NSGMLS program to enter the NSGMLS arguments, use the %F parameter to specify the current file.
  5. Insert the cursor in the Working directory field to add the working directory path using the %P parameter.
  6. Insert the cursor in the Menu Item Name field to label the tool.
  7. Check the Capture Output box. This option will list the validation results in the editor window.
  8. Finally, and most importantly, activate the Insert button to add the tool shortcut to the Advanced menu. If you miss this step, these settings will not be saved.

This validation option can be accessed via the Advanced menu, and will have a keyboard shortcut assigned.

Article feedback

Your comments on this article will be appreciated, please use the form below to submit your views. If you would like a reply or article update notification, include your email address.

Information: Your email address will not be mis-used. If you include your address you may be sent a personal reply, you will not be added to any mailing list unless you request update notification. Read the site privacy statement for details.

Add this page to your chosen social bookmarking service

Style warning - please read

Home · CSS · Java · Javascript · HTML · Help · Log