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 Ben Griffin <be...@redsnapper.net> on 2009/03/31 13:28:09 UTC

DOMLSParser: should I be using a XMLEntityResolver or DOMLSResourceResolver ?

I may be wrong ( I often am ), but it seems that when installing an  
XMLEntityResolver and a  DOMLSResourceResolver  into a DOMLSParser ,  
the one replaces the other.

I am not rightly sure that I know which one I should be using - and  
I'm also not rightly sure I know the purpose and difference between  
them, except for having different APIs.
I also do not really understand the advantages that one may have over  
the other.

http://xerces.apache.org/xerces-c/apiDocs-3/classXMLEntityResolver.html
"The parser will then allow the application to intercept any external  
entities (including the external DTD subset and external parameter  
entities, if any) before including them."

http://xerces.apache.org/xerces-c/apiDocs-3/classDOMLSResourceResolver.html
"The DOMLSParser will then allow the application to intercept any  
external entities (including the external DTD subset and external  
parameter entities) before including them."

I see that the XMLEntityResolver essentially returns an InputSource*,  
whereas the DOMLSResourceResolver returns a DOMLSInput*.

Thanks
	Ben.

Re: DOMLSParser: should I be using a XMLEntityResolver or DOMLSResourceResolver ?

Posted by Alberto Massari <am...@datadirect.com>.
They are different ways to achieve the same purpose: 
DOMLSResourceResolver is the interface defined by the W3C, 
XMLEntityResolver is defined by Xerces-C++. As you are using 
DOMLSParser, you should probably use DOMLSResourceResolver, unless you 
need the more powerful XMLEntityResolver (e.g. to get the location of 
the instruction that forced the loading of the external entity).

Alberto

Ben Griffin wrote:
> I may be wrong ( I often am ), but it seems that when installing an 
> XMLEntityResolver and a  DOMLSResourceResolver  into a DOMLSParser , 
> the one replaces the other.
>
> I am not rightly sure that I know which one I should be using - and 
> I'm also not rightly sure I know the purpose and difference between 
> them, except for having different APIs.
> I also do not really understand the advantages that one may have over 
> the other.
>
> http://xerces.apache.org/xerces-c/apiDocs-3/classXMLEntityResolver.html
> "The parser will then allow the application to intercept any external 
> entities (including the external DTD subset and external parameter 
> entities, if any) before including them."
>
> http://xerces.apache.org/xerces-c/apiDocs-3/classDOMLSResourceResolver.html 
>
> "The DOMLSParser will then allow the application to intercept any 
> external entities (including the external DTD subset and external 
> parameter entities) before including them."
>
> I see that the XMLEntityResolver essentially returns an InputSource*, 
> whereas the DOMLSResourceResolver returns a DOMLSInput*.
>
> Thanks
>     Ben.
>