[jdom-interest] Accessing a DTD bundled in a jar file...

Patrick JUSSEAU patrick at openbase.com
Wed Oct 15 04:01:04 PDT 2003


Hi,

I am trying to deploy one of my app using Java Web Start. JWS requires 
to put resources inside jar files. Since my app use xml files, I 
creates a xmlLib.jar file with the following output:

xml/test.xml
xml/test2.xml
xml/test.dtd

Inside my app, I use a ClassLoader to get xml file Resources as 
InputStream:

ClassLoader cl = getClass().getClassLoader();
inputStream = cl.getSystemResourceAsStream("xml/" + fileName);

The problem I have is that my xml file reference the test.dtd file as 
follow:
<!DOCTYPE PARAM SYSTEM "test.dtd">

I get the following exception when running my app
org.jdom.input.JDOMParseException: Error on line 2: Relative URI 
"test.dtd"; can not be resolved without a base URI.
         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:381)
         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:684)

I tried specifying a absolute http path to refer to the dtd file, which 
works but this is not really what I want to do. I want to keep my dtd 
file inside the jar file.

Any ideas?

Thanks in advance,

Patrick




More information about the jdom-interest mailing list