Ron,

I will have to check in more detail, but somehow wrapping things does not make sense to me. I will be back with a more educated reply later on.

Werner

Corcuera,Ron wrote:
We use Castor to generate Java files from a DTD file. We use org.exolab.castor.xml.Unmarshaller to unmarshall incoming XML files. Currently, Castor, using the SAX parser, fetches the DTD file stated in the incoming XML file. We would like for our code to fetch it from a local source instead.

After reading some documentation, it seems all I have to do is create a MyResolver that implements org.xml.sax.EntityResolver. I could then use the DTDResolver to wrap MyResolver and set the Unmarshaller to use it. Unfortunately, MyResolver is never called. The parser happily parses away after it fetches the dtd that is stated in the XML. The solution seems so easy and straight forward. But, I’m obviously missing something. Can someone point me in the right direction?

Here is a code snippet where I set the EntityResolver in the Unmarshaller:

String xmlRespString = // some xml file

StringReader stringReader = new StringReader(xmlRespString);

try

   {

      Unmarshaller um1 = new Unmarshaller();

      um1.setEntityResolver(new DTDResolver(new MyResolver()));

      msg = (MyMessage) um1.unmarshal(MyMessage.class, stringReader);

   }

...

Thank you,

Ron Corcuera



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to