reference to a DTD that resides in a jar file

A

avishosh

Hi,

I have a java program that reads it's settings from an .xml config
file with a refernce to a .dtd file but I want to store the .dtd in
the .jar file with the rest of the programs resources.
Anyone know how I'd write a doctype tag for this?
The .jar could be moved around on the server as could the .dtd so I
don't want to write an absolute path in the doctype declaration.
 
M

Martin Honnen

avishosh wrote:

I have a java program that reads it's settings from an .xml config
file with a refernce to a .dtd file but I want to store the .dtd in
the .jar file with the rest of the programs resources.
Anyone know how I'd write a doctype tag for this?
The .jar could be moved around on the server as could the .dtd so I
don't want to write an absolute path in the doctype declaration.

What are you using to parse? If you are using SAX then maybe it is
possible to implement your own org.xml.sax.EntityResolver, at least its
documentation says

If a SAX application needs to implement customized handling for external
entities, it must implement this interface and register an instance with
the SAX driver using the setEntityResolver method.

The XML reader will then allow the application to intercept any external
entities (including the external DTD subset and external parameter
entities, if any) before including them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top