1. DTD example

  1. Create a subdirectory named example1 in the addon/ subdirectory of XXE user preferences directory.

    XXE user preferences directory is:

    • $HOME/.xxe/ on Linux, Mac, and more generally, on Unix.

    • %APPDATA%\XMLmind\XMLeditor\ on Windows 2000, XP, Vista.

      Example: C:\Documents and Settings\john\Application Data\XMLmind\XMLeditor\ on Windows 2000 and XP. C:\Users\john\AppData\Roaming\XMLmind\XMLeditor\ on Windows Vista.

    Next chapter explains how to create a configuration which can be shared with other users. For now suffice to know that this personal addon/ directory is recursively scanned by XXE during its startup in order to load all files ending with ".xxe". (This also means that you are free to organize this subdirectory like you want.)

  2. Copy example1.dtd to directory addon/example1/.

    <!ELEMENT doc (para+)>
    <!ELEMENT para (#PCDATA)>
    <!ATTLIST para align (left|center|right) "left">
  3. Copy example1.css to directory addon/example1/.

    doc,
    para {
        display: block;
    }
    para {
        margin: 1ex 0;
    }
    para[align] {
        text-align: concatenate(attr(align));
    }
  4. Create a document template for DTD "-//XMLmind//DTD Example1//EN" using a text editor. Save it as addon/example1/example1.xml.

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE doc PUBLIC "-//XMLmind//DTD Example1//EN" 
      "http://www.xmlmind.com/public/dtd/example1.dtd">
    <doc>
      <para></para>
    </doc>

    It is highly recommended to use a public, absolute, URL such as "http://www.xmlmind.com/public/dtd/example1.dtd" rather than relative URL "example1.dtd".

  5. Using a text editor, create a XML catalog where public ID "-//XMLmind//DTD Example1//EN" is associated to local file example1.dtd. Save it as addon/example1/example1_catalog.xml.

    <?xml version="1.0" ?>
    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
             prefer="public">
      <public publicId="-//XMLmind//DTD Example1//EN"
              uri="example1.dtd"/>
    </catalog>

    This catalog will spare XXE the effort of downloading DTD example1.dtd from http://www.xmlmind.com/public/dtd/example1.dtd.

  6. Create a configuration file for XXE using XXE itself. Save it as addon/example1/example1.xxe.

    <?xml version='1.0' encoding='ISO-8859-1'?>
    <configuration name="Example1"
      xmlns="http://www.xmlmind.com/xmleditor/schema/configuration"
      xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration">
      <detect>
        <dtdPublicId>-//XMLmind//DTD Example1//EN</dtdPublicId>
      </detect>
    
      <css name="Style sheet" location="example1.css" />
    
      <template name="Template" location="example1.xml" />
    </configuration>

    If you create a configuration file with a text editor, do not forget to check its validity before deploying it because, for performance reasons, XXE does not thoroughly validates its configuration files at start-up time. The simplest way to do that is to open the configuration file in XXE.

  7. Restart XXE.

    Now you can use File|New and select Example1 > Template to create a new document.

    Important

    Do not forget to temporarily disable the Schema cache (using Options|Preferences, Schema tab, Enable cache toggle) if you intend to develop your own DTD and test it using XXE.

  8. Make sure that the template document is valid: the red icon must not be displayed at the bottom/left of XXE window.

    If the template document, example1.xml, is invalid, please use a text editor and fix it because XXE is not designed to be comfortable to use with invalid documents.

Short description of addon/example1/example1.xxe. See Configuration elements to have more details.