DTDs and schemas

DTDs, or document type definitions, are an older standard but are still widely used. Buffers which have an associated DTD are validated for errors, and completion popups are shown for elements, attributes, and entities. DTDs are specified by including markup like the following near the start of an XML file:

<?xml version="1.0"?>
 <!DOCTYPE PUBLIC "public ID" "system ID"
 

Or alternatively:

<?xml version="1.0"?>
 <!DOCTYPE SYSTEM "system ID"
 

XML schemas perform a similar function to DTDs, however they are a newer standard and support some features that DTDs do not, like namespaces. Buffers which have an associated schema are validated for errors, and completion popups are shown for elements and entities.

Schemas are specified with a http://www.w3.org/2001/XMLSchema-instance namespace in the document's root element:

<personnel
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation='personal.xsd'>

Or if the target schema has an associated namespace:

<dictionary           xmlns="http://www.xml-cml.org/schema/stmml"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.xml-cml.org/schema/stmml ../schema/stmml.xsd
          http://www.xml-cml.org/schema/cml2/core ../schema/cmlCore.xsd">

In all cases, the XML parser will first look for the specified system or public ID in the plugin's built-in catalog, along with any catalog files specified in the XML>Catalogs pane of the Plugins>Plugin Options dialog box.

Catalog files must either be in OASIS OPEN or XML catalog format. These two formats are documented below.

If the DTD or XSD cannot be located in the catalogs, the plugin will ask if it should be downloaded and cached for future use in the dtds subdirectory of the jEdit settings directory.

The download cache can be cleared using the Plugins>XML>Clear DTD Cache command.