i also strongly suspect that it's the parser that is attempting to resolve the DOCTYPE (rather than digester). IIRC all (compliant) xml parsers (even non-validating ones) need to resolve the DOCTYPE.

craig's absolutely right that the correct approach is to provide a custom entity resolver but i suspect that your problem lies with the behaviour of some parsers when null is returned - they then fall back to their original resolution mechanism.

if you want a workaround, then you may have more luck supplying an empty, non-null inputstream.

- robert

On 14 Jul 2004, at 22:30, Paolo Valladolid wrote:

This is the EntityResolver class I wrote:

public class MessageEntityResolver implements EntityResolver {
  public MessageEntityResolver() {
  }

  public InputSource resolveEntity (String publicId, String systemId) {
    System.out.println("systemid=" + systemId);
    return null;
  }

}

I added this line to the code calling the Digester:

digester.setEntityResolver(new MessageEntityResolver());

However, the digester still tried to process the <!DOCTYPE> tag.

Paolo Valladolid
Software Developer
DFI International Government Services


-----Original Message----- From: Craig McClanahan [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 5:26 PM To: Jakarta Commons Users List Subject: Re: [Digester] How do I get Digester to ignore the <!DOCTYPE> tag

Paolo Valladolid wrote:

I need to use Digester to parse XML that has been retrieved from a
database.  The XML I'm working with was received from elsewhere (ie.
Not
created by our team).  How do I get Digester to ignore the <!DOCTYPE>
tag?  I've tried setValidating( false ) and it did not work.



The setValidating(false) call does indeed tell Digester to not validate
the XML data. However, it does *not* tell the underlying XML parser to
skip the DOCTYPE, and there is no API in JAXP to say that sort of thing.


If your problem is unresolved entities, one thing you can do is to
provide your own EntityResolver method whose resolveEntity() method
always returns null. That way, the parser won't go traipsing around the


network trying to find things that it can't.



Thanks,



Paolo Valladolid

Software Developer

DFI International Government Services






Craig


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to