commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: [Digester] How to digester.register(String publicId,String entityURL) for local dtd file?
Date Thu, 16 Jun 2005 04:35:27 GMT
On Thu, 2005-06-16 at 00:13 -0400, Jon Steelman wrote:
> Digester's documentation shows the following as an example of how to
> tell Digester where to find a local copy of a dtd, in this case a Struts
> config file:
> URL url = new URL("/org/apache/struts/resources/struts-config_1_0.dtd");
> digester.register("-//Apache Software Foundation//DTD Struts
> Configuration 1.0//EN", url.toString());
> For a Struts file that begins with these 2 lines:
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <!DOCTYPE struts-config PUBLIC
>        "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
>               "">
> Now, in my case, for an xml file that starts with these 2 lines:
> <?xml version="1.0"?>
> <!DOCTYPE cardActionVendor SYSTEM "cardActionVendor.dtd">
> Apparently SYSTEM and PUBLIC differ and I'm not sure how to go about it
> in this case. How would you do the equivalent to tell Digester where to
> find the local copy? If I drop a copy of the dtd into the directory
> where Java is executing, it works, but I need to specify a different
> directory either relative or absolute.

SYSTEM is a totally non-portable identifier that is really only useful
on the same machine the document was created on.

PUBLIC is a portable identifier that is essentially a key used to look
up the real location of the corresponding resource. An application
receiving a document from a remote source is expected to register local
copies of the relevant document by public id, so the lookup returns a
local copy.

A document that is meant to be used across machines which omits the
PUBLIC identifier is broken.

Have you not seen the replies to your earlier question on this topic
from Thomas and myself?

Mapping system ids through to other URLs is just plain wrong; properly
designed XML documents should always have a PUBLIC id. This is why
Digester.register does not support mapping SYSTEM ids. However it
appears from Thomas' email that the entity resolver does
support this (ie helps people with broken xml documents) so that's one



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message