1. DTD example

Important

If you are writing a configuration file for XXE, please do not forget to temporarily disable the Quick Start and Schema caches by unchecking the corresponding checkboxes in OptionsPreferences, Advanced|Cached Data section. More information about these caches in Section 5.11.1, “Cached data options” in XMLmind XML Editor - Online Help.

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

    XXE user preferences directory is:

    • $HOME/.xxe5/ on Linux.

    • $HOME/Library/Application Support/XMLmind/XMLEditor5/ on the Mac.

    • %APPDATA%\XMLmind\XMLEditor5\ on Windows XP, Vista and 7.

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

      If you cannot see the "Application Data" directory using Microsoft Windows File Manager, turn on Tools>Folder Options>View>File and Folders>Show hidden files and folders.

    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. 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 validate 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 FileNew and select Example1/Template to create a new document.

  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.