Skip to content

How do I use the Mach II DTD in my configuration file?

thofrey edited this page Apr 1, 2014 · 6 revisions

Table of Contents

  1. The Importance of Being Valid - Use the DTD
  2. Defining the DTD
  3. Where are the official final release DTDs located (url)?
  4. Example

The Importance of Being Valid - Use the DTD

Mach-II comes bundled with a DTD file so you can validate your XML configuration files against the official known schema. This is extremely beneficial to developers because you can get instant feedback on if you are using the right attributes in a command or cannot remember an acceptable value for something like the statusType attribute in the redirect command.

Another important reason is there can be some un-intended behavior if certain things are not configured correctly. A notable example is the alias attribute in the cache command whereas the cache-clear command uses an aliases attribute. We support clearing multiple elements from a cache at once whereas it is only possible (and clearly logical) that the cache command is dealing with a single block. A misconfiguration of the cache-clear command using the singular alias attribute (which is incorrect and will cause a malformed XML configuration file) will cause the entire cache to be cleared instead of a single element as the developer is trying to do

So if you will indulge us being on our soapbox a little longer, take our advice and add in a <DOCTYPE> declaration to your XML configuration files and use the DTD with your XML editor (simple text editors like notepad do not support DTD validation so this is another excuse to use real XML editor).

Defining the DTD

The DTD is used to support validation of the configuration file, include one of the following DOCTYPE elements at the beginning (after the "xml" declaration):

    <!DOCTYPE mach-ii PUBLIC
            "-//Mach-II//DTD Mach-II Configuration 1.8.1//EN"
            "http://www.mach-ii.com/dtds/mach-ii_1_8_1.dtd">

    <!DOCTYPE mach-ii SYSTEM
            "http://localhost:8500/MachII/mach-ii_1_8_1.dtd">

    <!DOCTYPE mach-ii SYSTEM
            "http://pathToMachII/mach-ii_1_8_1.dtd">

You may have to modify the path to the DTD if you are hosting the DTD on your local system.

Where are the official final release DTDs located (url)?

All stable/final/BER (Bleeding Edge Release) DTDs are always located at:

    http://www.mach-ii.com/dtds/
DTD Release Location Note
mach-ii_1_1_1.dtd http://www.mach-ii.com/dtds/mach-ii_1_1_1.dtd
mach-ii_1_5_0.dtd http://www.mach-ii.com/dtds/mach-ii_1_5_0.dtd
mach-ii_1_6_0.dtd http://www.mach-ii.com/dtds/mach-ii_1_6_0.dtd
mach-ii_1_6_1.dtd http://www.mach-ii.com/dtds/mach-ii_1_6_1.dtd
mach-ii_1_8_0.dtd http://www.mach-ii.com/dtds/mach-ii_1_8_0.dtd
mach-ii_1_8_1.dtd http://www.mach-ii.com/dtds/mach-ii_1_8_1.dtd Latest stable release DTD
mach-ii_1_9_0.dtd http://www.mach-ii.com/dtds/mach-ii_1_9_0.dtd Latest DTD

Example

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE mach-ii PUBLIC
       "-//Mach-II//DTD Mach-II Configuration 1.8.1//EN"
       "http://www.mach-ii.com/dtds/mach-ii_1_8_1.dtd">

    <mach-ii version="1.8">
       ... stuff ...
    </mach-ii>

Back to FAQs

Clone this wiki locally