Validating against a custom DTD
How to validate using a custom DTD depends on how you validate:
Using an online validator
Examples of free online validators:
- WDG validator (has an option to validate an enitire site if it's not to big)
- W3C validator (single page only)
- Page valet (single page only)
If you want to use one of the online validators then you have to use a custom system doctype and upload the DTD to your server. An example doctype that refers to a custom DTD:
<!DOCTYPE HTML SYSTEM "http://example.com/mydtd.dtd">.
Note that it's possible that browsers will slip into quirks mode because of using a custom doctype (although I'm not aware of any that do).
Using a local validator
Examples of local validators:
- ARV Windows GUI validator, validates files on the local file system only.
- NSGMLS A free command line validator that can be called from various editors such as EditPlus, TextPad and UltraEdit (configuration guide).
Using a local validator may allow us to use the public doctype including the URI and then override that locally by redirecting to a local DTD, but only if you haven't added elements to it. If you add elements (for example the
nobr element) then you have to use a custom doctype with an uri that points to an online version of that custom DTD (see the example under "Using an online validator" above).
Example custom DTD
I validate against a custom DTD based on the HTML 4.01 Strict DTD that requires all non empty elements to be closed, it also requires the
head elements: html401-stricter.zip.
Note that aspects like mandatory attribute value quoting and tag and attribute case are not governed by the DTD, but by other config files that are also used by validators, note that these files are local to the validator. Instructions for forcing attribute value quoting for users of a local validator.