Eclipse validating xhtml slow updating a concrete bird bath
A better way to specify catalogs is to provide a properties file with a relative path to the catalog entry files. To prove that no net connection is required, I have written a JUnit test that runs with a security manager that blocks all net access.This test, along with all the other examples in this article, is available in the download.(It is worth noting as an aside that the DTD may be retrieved even if the parser is not validating, as this part of the XML spec explains.) For some applications this might not be a problem, but others might not have the luxury of a permanent net connection -- a J2ME Connected Limited Device Configuration, for instance.
However, using an absolute path is best avoided since it restricts the portability of your application.
Web applications, for instance, should be written in such a way as not to depend on where they are deployed on the filesystem, as this is typically out of their control.
March 3, 2004 Tom White XML documents often refer to other documents that an XML processor has to retrieve in order to make sense of the main document.
These external resources, typically referred to by URIs, may be local files; or they may be remote, distributed across the web.
Here is the simplest catalog entry file, called catalog.xml, that can be used to resolve the public identifier for an XHTML document to a local copy of the XHTML 1.0 DTD: entry that describes a mapping between the public identifier of an entity -- in this case -//W3C//DTD XHTML 1.0 Strict//EN -- and a preferred URI to locate the entity -- in this case the file catalog/xhtml1relative to
You need to manually download the DTD (and the referenced external entity files for XHTML) and put it in the correct local directory; the catalog simply provides the mapping, it doesn't provide automatic caching facilities.
We can solve all these potential problems by using an catalog.
A catalog is made up of one or more catalog entry files.
This article looks at how to use the Resolver classes with JAXP by working through three XML processing examples that cover the main capabilities of XML Catalogs.