You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by "Dantzler, DeWayne C" <de...@boeing.com> on 2007/11/01 23:15:19 UTC

RE: How to get the Parser to recognize the setDisableDefaultEntityResolutionoption

I was under the impression that by setting the option to disable the
default entity resolver (See setDisableDefaultEntityResolution below).
The parser would not try to resolve entity when a NULL is returned by my
entity resolver. How can I get this option to work? I'm having similar
issues with other options like getting an external DTD to be loaded and
used by the parser.

    /** Set the 'disable default entity resolution' flag
      *
      * This method gives users the option to not perform default entity
      * resolution.  If the user's resolveEntity method returns NULL the
      * parser will try to resolve the entity on its own.  When this
option
      * is set to true, the parser will not attempt to resolve the
entity
      * when the resolveEntity method returns NULL.
      *    
      * The parser's default state is false
      *
      * @param newValue The state to set
      *
      * @see #entityResolver
      */
    void setDisableDefaultEntityResolution(const bool newValue); 

-----Original Message-----
From: David Bertoni [mailto:dbertoni@apache.org]
Sent: Tuesday, October 30, 2007 5:09 PM
To: c-users@xerces.apache.org
Subject: Re: How to get the Parser to recognize the
setDisableDefaultEntityResolutionoption

Dantzler, DeWayne C wrote:
> I'm trying to get the Parser to check only for well-formness and 
> ignore external Entities. I've set the option to disable the default 
> entity resolver and overridden the resovler to return NULL, but the 
> Parser still attempts to open the DTD referenced in the document.
Returning a null pointer tells the parser the EntityResolver instance
did not try to resolve the entity.  Instead, return an InputSource
instance that's empty.  An easy way to do that is to return a
MemBufInputSource that has a length of 0.

Dave