I have some XML that I\'m parsing with a SAX parser in Java. It starts with this preamble:
When dealing with Web Apps, you can put the dtd in the lib folder and refer to it like:
<!DOCTYPE name PUBLIC
"-//CMP//DTD dtdName 1.0//EN"
"/WEB-INF/lib/dtdName.dtd">
The solution is to provide the DTD file location in the system using classpath. So the DocType that worked offline would be:
<!DOCTYPE hibernate-configuration SYSTEM
"classpath://org/hibernate/hibernate-configuration-3.0.dtd">
Take a look at this article on using XML catalogs to resolve DTDs locally without having to modify your XML source. The basic steps are:
Also another way can be to keep the dtd at the localhost so that the final path becomes something like:
<!DOCTYPE hibernate-configuration SYSTEM
"http://localhost/hibernate-configuration-3.0.dtd">
Definitely not the most elegant solution but surely does work.