Paul- I actually had this problem a few weeks ago. Castor is capable of fetching DTDs and schemas from the Castor JAR file, but the doctype has to match just right. Depending on the version of Castor you're running you can use the following:
Castor 0.9.9 and earlier: <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.exolab.org/mapping.dtd"> Recent Castor Builds (1.0Mx I think, might only be the most recent version): <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd"> When the underlying XML parser reads the DOCTYPE it will first ask Castor for a copy of the file. If the public ID or the system ID matches, Castor will pull from the JAR file, not requiring network access. If you're interested in the implementation of this (or want to do a similar procedure for your own DTDs/schemas) you can look at the source for org.exolab.castor.util.DTDResolver. That's also where you can get the public and system IDs that Castor is looking for. This procedure happens automatically for the loadMapping call, but if you want the same behavior during your own unmarshalling, you should call Unmarshaller.setEntityResolver( new DTDResolver() ). Aside: Yes Werner, this is also on my list of howtos-to-write :-) HTH, Stephen On 3/1/06, Paul Bertrand <[EMAIL PROTECTED]> wrote: > > Hello > > We are currently using the great Castor API in our project and unfortunately > it happens that, sometimes our application is running on firewalled servers > blocking most of the traffic. > The problem we encountered is that by defining the dtd location in the > begining of each mapping file as this > > <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version > 1.0//EN" "http://www.castor.org/mapping.dtd"> > > it happens that we can not reach the website creating. Then it creates > naturally an exception telling us that the validating process can t be done. > > We can not declare the DTD as SYSTEM instead of PUBLIC because we have too > many mapping files located at different places ( plus mapping in .jar > files). > I tried to remove the DTD definition and it works. It appeared that the > validation of the file does occur even without the dtd declaration (internal > validating????). I added some misspelled attributes and elements in the > mapping and the same exception has been thrown. > > The purpose of this message is that I would like to be absolutely sure > before changing 50 mappings that removing the DTD definition is safe. > > Thanks

