Charles Eckel (eckelcu) wrote:
When I open an XML file in XMLmind, it assumes the dtd file is in the same
directory as the opened file.

Not exactly. As mandated by the XML standard, it uses the system ID of the DTD, whatever is this system ID.

Example: let's suppose your XML document starts with:

---
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE section PUBLIC "-//XMLmind//DTD Simple Section//EN"
"http://www.xmlmind.com/dtd/section.dtd";>

<section>
...
</section>
---

The public ID, that is, the formal name of the DTD, of the above DTD is:

-//XMLmind//DTD Simple Section//EN

The system ID, that is, the location of the DTD file, of the above DTD is:

http://www.xmlmind.com/dtd/section.dtd

This location can be relative or absolute. If relative, then it's relative to the location of the XML document.




Is there a way to specific an ³include² path
and have it look there for the dtd for any XML file?

Yes, there is a standard mechanism for that called *XML* *catalogs*.

Article: "XML Entity and URI Resolvers" -- http://xerces.apache.org/xml-commons/components/resolver/resolver-article.html

OASIS standard: "XML Catalogs, OASIS Standard V1.1, 7 October 2005" -- https://www.oasis-open.org/committees/download.php/14809/std-entity-xml-catalogs-1.1.html



XML catalog for the above example:

---
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
         prefer="public">
  <public publicId="-//XMLmind//DTD Simple Section//EN"
          uri="file:/C:/Users/charles/Documents/dtd/section.dtd"/>
</catalog>
---

Basically, the above XML catalog maps a public ID "-//XMLmind//DTD Simple Section//EN" to an alternate, local, system ID "file:/C:/Users/charles/Documents/dtd/section.dtd". (Notice the use of URLs, not filenames.)



In order to deploy this catalog:

1) Copy the XML catalog file to any of the two addon/ folders scanned by XMLmind XML Editor during its startup:

* XXE_install_dir/addon/

* XXE_user_preferences_dir/addon/ where XXE_user_preferences_dir/ is:

-----------------------------------------------------------
    ** $HOME/.xxe5/ on Linux.

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

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

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

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.
-----------------------------------------------------------


2) Click "Quick Start cache|Clear" in the "Options|Preferences" dialog box, "Advanced|Cached data" section, to force XMLmind XML Editor to rescan its two addon/ folders.

More info: http://www.xmlmind.com/xmleditor/_distrib/doc/help/advancedOptions.html


3) Restart XMLmind XML Editor.



--------------------------------
XMLmind XML Editor configuration
--------------------------------

You seem to use XMLmind XML Editor without a configuration which would teach XMLmind XML Editor how to cope with the type of XML documents you edit.

XMLmind XML Editor is a below than the average XML editor, unless an ad-hoc configuration has been developed for the type of documents being edited.

Out of the box, we provide configurations for XHTML, DocBook and DITA. There are also advanced configurations contributed by third-party developers: Daisy, TEI, EAD, etc.

It's not difficult to write a simple configuration for your document type. See "Writing a configuration file for XXE" -- http://www.xmlmind.com/xmleditor/_distrib/doc/configure/config_file.html

Of course, an XML catalog is often an integral part of even the simplest configuration.


--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to