wiki:FAQUsingDTD

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

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 DTDs are always located at (directory listing is enabled):

http://www.mach-ii.com/dtds/

Webserver directory listings are available for this directory. Accessing that directory will give you a list of all the currently available DTDs.

The latest stable release DTD (currently Mach-II 1.8.1) is located at:

http://www.mach-ii.com/dtds/mach-ii_1_8_1.dtd

The latest BER of the Mach-II 1.9 DTD is located at:

http://www.mach-ii.com/dtds/mach-ii_1_9_0.dtd

Bleeding edge release DTDs are updated to the above URL on each nightly ZIP release.

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