Using the XML Catalog
The eclipes WTP project provides support for using an XML Catalog based on the OASIS XML Catalog specification. An XML Catalog provides some limited control over how references to other resources handled. So for example if a user has one or more XML documents that reference a DTD or XML Schema via a web address (e.g. http://www.example.org/foo.xsd) they can use the XML Catalog to map this address to their own local copy of this resource. This way 'catalog aware' tools won't need to go off to the internet to fetch the resource. There's several other ways an XML Catalog can be used as defined by the OASIS XML Catalog specification. If you're an eclipse plugin developer there's also some convenient extension points you can utilize to contribute to the XML Catalog settings.
Editing the XML Catalog Settings
The XML Catalog can be accessed through the preferences as follows...
1. Select “Window -> Preferences” to launch the Preferences dialog.
2. Expand the “Web and XML” heading and select “XML Catalog”.
Working With DTDs
If your working with XML documentthat contain 'DOCTYPE' declarations to reference DTD resources you can control how the referenced documents are resolved. If your XML documents utlize DOCTYPE declarations that specify a PUBLIC ID (as shown in fig x below) you can user the XML Catalog to regist a local DTD file using the PUBLIC ID as the key. If an XML document contains a DOCTYPE like this
<!DOCTYPE Invoice PUBLIC "-//EXAMPLE//DTD INVOICE//EN" "http://www.example.org/Invoice.dtd">
If you examine the XML Catalog setting in WTP you'll notice that there's several DTD related entries that specify a PUBLIC ID key.
<!DOCTYPE Invoice SYSTEM "http://www.example.org/Invoice.dtd">
Registering XML Schemas
TODO.. by Namespace Name by Schema Location
- I've registered a DTD with a 'System ID' key of 'foo.dtd' and it doesn't work. Why not? Locations in an XML instance get expanded _before_ the XML Catalog is referenced. So the XML Catalog should contain only fully qualified URIs (e.g. http://www.example.org/foo.dtd).
- I've registered an XML Schema with a 'Schema Location' key of 'foo.xsd' and it doesn't work. Why not? Locations in an XML instance get expanded _before_ the XML Catalog is referenced. So the XML Catalog should contain only fully qualified URIs(e.g. http://www.example.org/foo.xsd).
- I've registered my DTD or XML Schema but eclipse is still going off to the internet to fetch a resource. Why? The registested DTD and XML Schema may have references to more DTDs and XML Schemas.
- I've registered an XML Schema by namespace but XML files are still using the 'xsi:schemaLocation' value. Why?
An explicitly specified schema location value takes precedence over XML Catalog entries that are keyed by namespace.
- Can I register multiple XML Schemas for the same namespace?
No you can't. There should be only one XML Schema registered for a given namespace.