a DTD as a JAR file resource [was Re: RFC: Simple XML Event-Based API for Java]
reast at esri.com
Thu Dec 18 02:54:08 GMT 1997
Antony Blakey wrote:
> .... What we need to do is ... provide the
> input stream from within the program ie. the entity is stored as a string, or accessed
> through ClassLoader.getResourceAsStream()...
Yes! I would like to be able to store one or more DTDs as
resources within a JAR file. Within a <!doctype ... SYSTEM "URL">
I'd like to be able to refer to that DTD, rather than, refering
to some server-side DTD. But, I don't think we can do this now, because,
we can't specify a URL for a JAR resource - well, we can't do it in a
platform independent manner anyway, because JavaSoft states, at
"The method getResource() returns a URL for the resource.
The URL (and its representation) is implementation-specific
and may vary depending on the implementation details (it may
also change between JDK1.1 and JDK1.1.1). Its protocol is
(usually) specific to the ClassLoader loading the resource.
If the resource does not exist, a null will be returned."
It's hard to test this, firstly Netscape doesn't yet seem to support
ClassLoader.getResource() and IE4 doesn't seem to support JARs as
containers for resources. For instance, I have a sample applet which
is placed into a JAR along with a resource named test.dtd. Within
JDK 1.1.4 appletviewer, getResource() returns the URL of this
resource as: appletresource:/file:/D:/Ims/z//+/test.dtd
or : appletresource://gumnut/http://gumnut/ims/z//+/test.dtd
depending on whether I access the HTML thru my webserver or not.
It would be good to be able to specify one of these URLs in SYSTEM,
and have it work in all cases - not just appletviewer.
Do the XML parser developers have any suggestions on how to achieve this?
Does it make sense to have a special API for the parser through which
you can not only specify an xml document, but also a separate dtd ?
Russell East mailto:reast at esri.com
_|_| Programmer phn: +1 (909) 793 2853
_|_| ESRI, 380 New York St fax: +1 (909) 307 3067
Redlands CA 92373-8100 http://maps.esri.com/
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev