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 Umesh Chandak <um...@gslab.com> on 2007/05/29 11:08:05 UTC

how to prevent the xerces from accessing the network in case of custom entity resolution

Hi All,

I have installed my custom entity resolver like this 
XMLEntityResolver * currentEntityResolver =
parser->getXMLEntityResolver();
XMLImportIncludeResolverWrapper* r = new
XMLImportIncludeResolverWrapper(currentEntityResolver,
entityResolver,entityResolverArg, errors) ;
parser->setXMLEntityResolver(r);

But if my custom entityResolver returns NULL then I got the error 
An exception occurred! Type:NetAccessorException, Message:The
host/address 'schemas.xmlsoap.org' could not be resolved. 

One of the reason for this is I had shut down my network service. But As
I have installed my own custom enityResolver then why it is trying to
access the network. Is there any way to get rid of this error by setting
any flag or property so that Xerces will not try to access the network. 

Thanks.
Regards,
Umesh
-- 
Umesh Chandak <um...@gslab.com>


Re: schema validation failing for xerces

Posted by Alberto Massari <am...@datadirect.com>.
Hi Umesh,
the XML file is also referencing a schema for the foo namespace 
(xsi:schemaLocation="foo particlesB013_1.xsd"); if by chance this 
schema really exists, then b is defined and valid. I tried removing 
the schemaLocation attribute and I got the expected "Unknown element 
'b'" error.

Alberto

At 18.59 18/07/2007 +0530, Umesh Chandak wrote:
>Hi All,
>     I am using the loadGrammar function for validating xml instances
>against xml schema. But According to me instance is invalid but xerces
>says it is valid.
>*******************************XSD FILE ************************
><?xml version="1.0"?>
><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>         <xsd:element name="doc">
>                 <xsd:complexType>
>                         <xsd:choice>
>                                 <xsd:element name="elem" type="elem"/>
>                         </xsd:choice>
>                 </xsd:complexType>
>         </xsd:element>
>         <xsd:complexType name="elem">
>                 <xsd:choice>
>                         <xsd:any maxOccurs="2"/>
>                 </xsd:choice>
>         </xsd:complexType>
></xsd:schema>
>****************************************************************
>**************************XML FILE *****************************
><?xml version="1.0"?>
><doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>xsi:noNamespaceSchemaLocation="particlesB013.xsd"
>xsi:schemaLocation="foo particlesB013_1.xsd">
>         <elem>
>                 <b xmlns="foo"/>
>         </elem>
></doc>
>*****************************************************************
>According to me this instance is invalid because element 'b' which falls
>in 'any' wildcard group with processContent = strict because by default
>processContent is strict. But there is no declaration of element 'b' is
>available in XSD file.
>
>Please let me know why Xerces is saying valid instance to this. This
>example is from MicroSoft's MSSchemaTestSuite test suite.
>
>Thanks.
>Regards,
>Umesh


Re: precedence between processContent and nameSpace attribute of wildcard

Posted by Alberto Massari <am...@datadirect.com>.
Hi Umesh,
this is the change I committed: 
http://svn.apache.org/viewvc?view=rev&revision=559795

Alberto

At 18.27 26/07/2007 +0530, Umesh Chandak wrote:
>Hi Alberto,
>Thanks. I also did the fix for this issue at my end in function
>traverseAny. Actually the problem is not with ##targetNamespace it's a
>problem with the namespace list when list contains more than two name
>spaces. Again I would like to know in which part of code you made the
>changes. I would like to incorporate your changes because those are
>going to be the reliable one. Though to tell you I made changes in the
>traverseAny function. I preserved the pointer to lax setting and
>returned that pointer instead of returning the last 'secondNode'
>created. Please let me know whether my fix and your fix is same. I was
>about to inform you this evening about this bug but your mail came
>first.
>
>Thanks.
>Regards,
>Umesh
>
>On Thu, 2007-07-26 at 14:35 +0200, Alberto Massari wrote:
> > Hi Umesh,
> > the 'lax' setting is lost when the namespace list contains more than
> > 2 choices (regardless if it's a ##targetNamespace or a fixed URI); I
> > have committed a fix for this bug.
> >
> > Alberto
> >
> > At 09.56 26/07/2007 +0530, Umesh Chandak wrote:
> > >Hi Alberto,
> > >Thanks for your reply. My comment is inline.
> > >On Wed, 2007-07-25 at 15:57 +0200, Alberto Massari wrote:
> > > > Hi Umesh,
> > > > I tried your testcase with Xerces 2.7, and it reports an error
> > > > ('unknown element bar:bar'; which version are you using?
> > > >
> > > > Alberto
> > > >
> > > > At 18.58 25/07/2007 +0530, Umesh Chandak wrote:
> > > > >Hi All,
> > > > >    Is there any precedence between processContent = strict 
> and namespace
> > > > >attribute of wildcard group.
> > > > >Consider for example
> > > > >**************XSD File *******************
> > > > >
> > > > ><?xml version="1.0"?>
> > > > ><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > > >targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
> > > > >elementFormDefault="qualified">
> > > > >         <xsd:element name="doc">
> > > > >                 <xsd:complexType>
> > > > >                         <xsd:sequence>
> > > > >                                 <xsd:element name="elem" type="x:any"
> > > > >minOccurs="0" maxOccurs="100"/>
> > > > >                         </xsd:sequence>
> > > > >                 </xsd:complexType>
> > > > >         </xsd:element>
> > > > >         <xsd:complexType name="any">
> > > > >                 <xsd:choice>
> > > > >                         <xsd:any processContents="strict" 
> namespace="foo
> > > > >bar ##targetNamespace" minOccurs="0" maxOccurs="100"/>
> > >It's my mistake. Here processContents="lax". But
> > >xsWildcard::getProcessContents returns me PC_STRICT and this occurs
> > >because of ##targetNamespace in the namespace list. If I remove the
> > >##targetNamespace then it gives me PC_LAX. I think this is the bug in
> > >xerces. You can try SCMPrint sample programs to observe this behaviour.
> > >Please let me know whether this is the expected behaviour or bug in
> > >Xerces. My version of xerces is 2.7
> > >Thanks.
> > >Regards,
> > >Umesh
> > >
> > > > >                 </xsd:choice>
> > > > >         </xsd:complexType>
> > > > >         <xsd:element name="foo"/>
> > > > ></xsd:schema>
> > > > >*******************XSD End **************************
> > > > >*******************XML File *************************
> > > > ><?xml version="1.0"?>
> > > > ><x:doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > >xmlns:x="http://xsdtesting" xsi:schemaLocation="http://xsdtesting
> > > > >particlesC029.xsd">
> > > > >         <x:elem>
> > > > >                 <bar:bar xmlns:bar="bar"/>
> > > > >         </x:elem>
> > > > ></x:doc>
> > > > >********************XML END*****************************
> > > > >1) If we go according to strict then xml is invalid because 
> there is no
> > > > >definition for 'bar:bar' element
> > > > >2) If we go according to the namespace then it's valid because bar
> > > > >element is from the list of namespaces 'foo bar http://xsdtesting'
> > > > >
> > > > >Xerces says that this is the Valid instance i.e. it is going according
> > > > >to namespace .
> > > > >Please let me know if there is any such precedence followed in xerces.
> > > > >If possible please give the reference because in spec I didn't find
> > > > >anything regarding such precedence.
> > > > >
> > > > >Thanks.
> > > > >Regards,
> > > > >Umesh
> > > >
> > > >
> > >--
> > >Umesh Chandak <um...@gslab.com>
> >
> >
>--
>Umesh Chandak <um...@gslab.com>


Re: precedence between processContent and nameSpace attribute of wildcard

Posted by Umesh Chandak <um...@gslab.com>.
Hi Alberto, 
Thanks. I also did the fix for this issue at my end in function
traverseAny. Actually the problem is not with ##targetNamespace it's a
problem with the namespace list when list contains more than two name
spaces. Again I would like to know in which part of code you made the
changes. I would like to incorporate your changes because those are
going to be the reliable one. Though to tell you I made changes in the
traverseAny function. I preserved the pointer to lax setting and
returned that pointer instead of returning the last 'secondNode'
created. Please let me know whether my fix and your fix is same. I was
about to inform you this evening about this bug but your mail came
first.   

Thanks.
Regards,
Umesh

On Thu, 2007-07-26 at 14:35 +0200, Alberto Massari wrote:
> Hi Umesh,
> the 'lax' setting is lost when the namespace list contains more than 
> 2 choices (regardless if it's a ##targetNamespace or a fixed URI); I 
> have committed a fix for this bug.
> 
> Alberto
> 
> At 09.56 26/07/2007 +0530, Umesh Chandak wrote:
> >Hi Alberto,
> >Thanks for your reply. My comment is inline.
> >On Wed, 2007-07-25 at 15:57 +0200, Alberto Massari wrote:
> > > Hi Umesh,
> > > I tried your testcase with Xerces 2.7, and it reports an error
> > > ('unknown element bar:bar'; which version are you using?
> > >
> > > Alberto
> > >
> > > At 18.58 25/07/2007 +0530, Umesh Chandak wrote:
> > > >Hi All,
> > > >    Is there any precedence between processContent = strict and namespace
> > > >attribute of wildcard group.
> > > >Consider for example
> > > >**************XSD File *******************
> > > >
> > > ><?xml version="1.0"?>
> > > ><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > >targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
> > > >elementFormDefault="qualified">
> > > >         <xsd:element name="doc">
> > > >                 <xsd:complexType>
> > > >                         <xsd:sequence>
> > > >                                 <xsd:element name="elem" type="x:any"
> > > >minOccurs="0" maxOccurs="100"/>
> > > >                         </xsd:sequence>
> > > >                 </xsd:complexType>
> > > >         </xsd:element>
> > > >         <xsd:complexType name="any">
> > > >                 <xsd:choice>
> > > >                         <xsd:any processContents="strict" namespace="foo
> > > >bar ##targetNamespace" minOccurs="0" maxOccurs="100"/>
> >It's my mistake. Here processContents="lax". But
> >xsWildcard::getProcessContents returns me PC_STRICT and this occurs
> >because of ##targetNamespace in the namespace list. If I remove the
> >##targetNamespace then it gives me PC_LAX. I think this is the bug in
> >xerces. You can try SCMPrint sample programs to observe this behaviour.
> >Please let me know whether this is the expected behaviour or bug in
> >Xerces. My version of xerces is 2.7
> >Thanks.
> >Regards,
> >Umesh
> >
> > > >                 </xsd:choice>
> > > >         </xsd:complexType>
> > > >         <xsd:element name="foo"/>
> > > ></xsd:schema>
> > > >*******************XSD End **************************
> > > >*******************XML File *************************
> > > ><?xml version="1.0"?>
> > > ><x:doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > >xmlns:x="http://xsdtesting" xsi:schemaLocation="http://xsdtesting
> > > >particlesC029.xsd">
> > > >         <x:elem>
> > > >                 <bar:bar xmlns:bar="bar"/>
> > > >         </x:elem>
> > > ></x:doc>
> > > >********************XML END*****************************
> > > >1) If we go according to strict then xml is invalid because there is no
> > > >definition for 'bar:bar' element
> > > >2) If we go according to the namespace then it's valid because bar
> > > >element is from the list of namespaces 'foo bar http://xsdtesting'
> > > >
> > > >Xerces says that this is the Valid instance i.e. it is going according
> > > >to namespace .
> > > >Please let me know if there is any such precedence followed in xerces.
> > > >If possible please give the reference because in spec I didn't find
> > > >anything regarding such precedence.
> > > >
> > > >Thanks.
> > > >Regards,
> > > >Umesh
> > >
> > >
> >--
> >Umesh Chandak <um...@gslab.com>
> 
> 
-- 
Umesh Chandak <um...@gslab.com>


Re: precedence between processContent and nameSpace attribute of wildcard

Posted by Alberto Massari <am...@datadirect.com>.
Hi Umesh,
the 'lax' setting is lost when the namespace list contains more than 
2 choices (regardless if it's a ##targetNamespace or a fixed URI); I 
have committed a fix for this bug.

Alberto

At 09.56 26/07/2007 +0530, Umesh Chandak wrote:
>Hi Alberto,
>Thanks for your reply. My comment is inline.
>On Wed, 2007-07-25 at 15:57 +0200, Alberto Massari wrote:
> > Hi Umesh,
> > I tried your testcase with Xerces 2.7, and it reports an error
> > ('unknown element bar:bar'; which version are you using?
> >
> > Alberto
> >
> > At 18.58 25/07/2007 +0530, Umesh Chandak wrote:
> > >Hi All,
> > >    Is there any precedence between processContent = strict and namespace
> > >attribute of wildcard group.
> > >Consider for example
> > >**************XSD File *******************
> > >
> > ><?xml version="1.0"?>
> > ><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > >targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
> > >elementFormDefault="qualified">
> > >         <xsd:element name="doc">
> > >                 <xsd:complexType>
> > >                         <xsd:sequence>
> > >                                 <xsd:element name="elem" type="x:any"
> > >minOccurs="0" maxOccurs="100"/>
> > >                         </xsd:sequence>
> > >                 </xsd:complexType>
> > >         </xsd:element>
> > >         <xsd:complexType name="any">
> > >                 <xsd:choice>
> > >                         <xsd:any processContents="strict" namespace="foo
> > >bar ##targetNamespace" minOccurs="0" maxOccurs="100"/>
>It's my mistake. Here processContents="lax". But
>xsWildcard::getProcessContents returns me PC_STRICT and this occurs
>because of ##targetNamespace in the namespace list. If I remove the
>##targetNamespace then it gives me PC_LAX. I think this is the bug in
>xerces. You can try SCMPrint sample programs to observe this behaviour.
>Please let me know whether this is the expected behaviour or bug in
>Xerces. My version of xerces is 2.7
>Thanks.
>Regards,
>Umesh
>
> > >                 </xsd:choice>
> > >         </xsd:complexType>
> > >         <xsd:element name="foo"/>
> > ></xsd:schema>
> > >*******************XSD End **************************
> > >*******************XML File *************************
> > ><?xml version="1.0"?>
> > ><x:doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > >xmlns:x="http://xsdtesting" xsi:schemaLocation="http://xsdtesting
> > >particlesC029.xsd">
> > >         <x:elem>
> > >                 <bar:bar xmlns:bar="bar"/>
> > >         </x:elem>
> > ></x:doc>
> > >********************XML END*****************************
> > >1) If we go according to strict then xml is invalid because there is no
> > >definition for 'bar:bar' element
> > >2) If we go according to the namespace then it's valid because bar
> > >element is from the list of namespaces 'foo bar http://xsdtesting'
> > >
> > >Xerces says that this is the Valid instance i.e. it is going according
> > >to namespace .
> > >Please let me know if there is any such precedence followed in xerces.
> > >If possible please give the reference because in spec I didn't find
> > >anything regarding such precedence.
> > >
> > >Thanks.
> > >Regards,
> > >Umesh
> >
> >
>--
>Umesh Chandak <um...@gslab.com>


Re: precedence between processContent and nameSpace attribute of wildcard

Posted by Umesh Chandak <um...@gslab.com>.
Hi Alberto,
Thanks for your reply. My comment is inline.
On Wed, 2007-07-25 at 15:57 +0200, Alberto Massari wrote:
> Hi Umesh,
> I tried your testcase with Xerces 2.7, and it reports an error 
> ('unknown element bar:bar'; which version are you using?
> 
> Alberto
> 
> At 18.58 25/07/2007 +0530, Umesh Chandak wrote:
> >Hi All,
> >    Is there any precedence between processContent = strict and namespace
> >attribute of wildcard group.
> >Consider for example
> >**************XSD File *******************
> >
> ><?xml version="1.0"?>
> ><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
> >elementFormDefault="qualified">
> >         <xsd:element name="doc">
> >                 <xsd:complexType>
> >                         <xsd:sequence>
> >                                 <xsd:element name="elem" type="x:any"
> >minOccurs="0" maxOccurs="100"/>
> >                         </xsd:sequence>
> >                 </xsd:complexType>
> >         </xsd:element>
> >         <xsd:complexType name="any">
> >                 <xsd:choice>
> >                         <xsd:any processContents="strict" namespace="foo
> >bar ##targetNamespace" minOccurs="0" maxOccurs="100"/>
It's my mistake. Here processContents="lax". But
xsWildcard::getProcessContents returns me PC_STRICT and this occurs
because of ##targetNamespace in the namespace list. If I remove the
##targetNamespace then it gives me PC_LAX. I think this is the bug in
xerces. You can try SCMPrint sample programs to observe this behaviour.
Please let me know whether this is the expected behaviour or bug in
Xerces. My version of xerces is 2.7
Thanks.
Regards,
Umesh

> >                 </xsd:choice>
> >         </xsd:complexType>
> >         <xsd:element name="foo"/>
> ></xsd:schema>
> >*******************XSD End **************************
> >*******************XML File *************************
> ><?xml version="1.0"?>
> ><x:doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >xmlns:x="http://xsdtesting" xsi:schemaLocation="http://xsdtesting
> >particlesC029.xsd">
> >         <x:elem>
> >                 <bar:bar xmlns:bar="bar"/>
> >         </x:elem>
> ></x:doc>
> >********************XML END*****************************
> >1) If we go according to strict then xml is invalid because there is no
> >definition for 'bar:bar' element
> >2) If we go according to the namespace then it's valid because bar
> >element is from the list of namespaces 'foo bar http://xsdtesting'
> >
> >Xerces says that this is the Valid instance i.e. it is going according
> >to namespace .
> >Please let me know if there is any such precedence followed in xerces.
> >If possible please give the reference because in spec I didn't find
> >anything regarding such precedence.
> >
> >Thanks.
> >Regards,
> >Umesh
> 
> 
-- 
Umesh Chandak <um...@gslab.com>


Re: precedence between processContent and nameSpace attribute of wildcard

Posted by Alberto Massari <am...@datadirect.com>.
Hi Umesh,
I tried your testcase with Xerces 2.7, and it reports an error 
('unknown element bar:bar'; which version are you using?

Alberto

At 18.58 25/07/2007 +0530, Umesh Chandak wrote:
>Hi All,
>    Is there any precedence between processContent = strict and namespace
>attribute of wildcard group.
>Consider for example
>**************XSD File *******************
>
><?xml version="1.0"?>
><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
>elementFormDefault="qualified">
>         <xsd:element name="doc">
>                 <xsd:complexType>
>                         <xsd:sequence>
>                                 <xsd:element name="elem" type="x:any"
>minOccurs="0" maxOccurs="100"/>
>                         </xsd:sequence>
>                 </xsd:complexType>
>         </xsd:element>
>         <xsd:complexType name="any">
>                 <xsd:choice>
>                         <xsd:any processContents="strict" namespace="foo
>bar ##targetNamespace" minOccurs="0" maxOccurs="100"/>
>                 </xsd:choice>
>         </xsd:complexType>
>         <xsd:element name="foo"/>
></xsd:schema>
>*******************XSD End **************************
>*******************XML File *************************
><?xml version="1.0"?>
><x:doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>xmlns:x="http://xsdtesting" xsi:schemaLocation="http://xsdtesting
>particlesC029.xsd">
>         <x:elem>
>                 <bar:bar xmlns:bar="bar"/>
>         </x:elem>
></x:doc>
>********************XML END*****************************
>1) If we go according to strict then xml is invalid because there is no
>definition for 'bar:bar' element
>2) If we go according to the namespace then it's valid because bar
>element is from the list of namespaces 'foo bar http://xsdtesting'
>
>Xerces says that this is the Valid instance i.e. it is going according
>to namespace .
>Please let me know if there is any such precedence followed in xerces.
>If possible please give the reference because in spec I didn't find
>anything regarding such precedence.
>
>Thanks.
>Regards,
>Umesh


precedence between processContent and nameSpace attribute of wildcard

Posted by Umesh Chandak <um...@gslab.com>.
Hi All,
   Is there any precedence between processContent = strict and namespace
attribute of wildcard group. 
Consider for example 
**************XSD File *******************

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
elementFormDefault="qualified">
        <xsd:element name="doc">
                <xsd:complexType>
                        <xsd:sequence>
                                <xsd:element name="elem" type="x:any"
minOccurs="0" maxOccurs="100"/>
                        </xsd:sequence>
                </xsd:complexType>
        </xsd:element>
        <xsd:complexType name="any">
                <xsd:choice>
                        <xsd:any processContents="strict" namespace="foo
bar ##targetNamespace" minOccurs="0" maxOccurs="100"/>
                </xsd:choice>
        </xsd:complexType>
        <xsd:element name="foo"/>
</xsd:schema>
*******************XSD End **************************
*******************XML File *************************
<?xml version="1.0"?>
<x:doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:x="http://xsdtesting" xsi:schemaLocation="http://xsdtesting
particlesC029.xsd">
        <x:elem>
                <bar:bar xmlns:bar="bar"/>
        </x:elem>
</x:doc>
********************XML END*****************************
1) If we go according to strict then xml is invalid because there is no
definition for 'bar:bar' element
2) If we go according to the namespace then it's valid because bar
element is from the list of namespaces 'foo bar http://xsdtesting'

Xerces says that this is the Valid instance i.e. it is going according
to namespace .
Please let me know if there is any such precedence followed in xerces.
If possible please give the reference because in spec I didn't find
anything regarding such precedence.

Thanks.
Regards,
Umesh


schema validation failing for xerces

Posted by Umesh Chandak <um...@gslab.com>.
Hi All,
    I am using the loadGrammar function for validating xml instances
against xml schema. But According to me instance is invalid but xerces
says it is valid. 
*******************************XSD FILE ************************
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<xsd:element name="doc">
		<xsd:complexType>
			<xsd:choice>
				<xsd:element name="elem" type="elem"/>
			</xsd:choice>
		</xsd:complexType>
	</xsd:element>
	<xsd:complexType name="elem">
		<xsd:choice>
			<xsd:any maxOccurs="2"/>
		</xsd:choice>
	</xsd:complexType>
</xsd:schema>
****************************************************************
**************************XML FILE *****************************
<?xml version="1.0"?>
<doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="particlesB013.xsd"
xsi:schemaLocation="foo particlesB013_1.xsd">
	<elem>
		<b xmlns="foo"/>
	</elem>
</doc>
*****************************************************************
According to me this instance is invalid because element 'b' which falls
in 'any' wildcard group with processContent = strict because by default
processContent is strict. But there is no declaration of element 'b' is
available in XSD file.

Please let me know why Xerces is saying valid instance to this. This
example is from MicroSoft's MSSchemaTestSuite test suite.

Thanks.
Regards,
Umesh    






Re: how to prevent the xerces from accessing the network in case of custom entity resolution

Posted by Umesh Chandak <um...@gslab.com>.
Hi,
My load grammar function fails when I return NULL from my own entity
resolver class and  xmlri->getResourceIdentifierType() is
XMLResourceIdentifier::ExternalEntity and I had disabled the
fgXercesDisableDefaultEntityResolution.

Thanks.
Regards,
Umesh  
On Tue, 2007-05-29 at 12:11 +0200, Alberto Massari wrote:
> At 15.36 29/05/2007 +0530, Umesh Chandak wrote:
> >Thanks for the reply.
> >But I am using the SAX2XMLReaderImpl class of the exerces and I don't
> >see any such method in this class.
> 
> You need to use 
> setFeature(XMLUni::fgXercesDisableDefaultEntityResolution, true)
> 
> Alberto
> 
> 
> >Thanks.
> >Regards,
> >Umesh
> >On Tue, 2007-05-29 at 11:15 +0200, Alberto Massari wrote:
> > > Hi Umesh,
> > > you neeed to use setDisableDefaultEntityResolution(true)
> > >
> > > void AbstractDOMParser::setDisableDefaultEntityResolution (  const
> > > bool  newValue  )
> > >
> > > 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
> > >
> > > Parameters:
> > > newValue The state to set
> > >
> > > Alberto
> > >
> > > At 14.38 29/05/2007 +0530, Umesh Chandak wrote:
> > > >Hi All,
> > > >
> > > >I have installed my custom entity resolver like this
> > > >XMLEntityResolver * currentEntityResolver =
> > > >parser->getXMLEntityResolver();
> > > >XMLImportIncludeResolverWrapper* r = new
> > > >XMLImportIncludeResolverWrapper(currentEntityResolver,
> > > >entityResolver,entityResolverArg, errors) ;
> > > >parser->setXMLEntityResolver(r);
> > > >
> > > >But if my custom entityResolver returns NULL then I got the error
> > > >An exception occurred! Type:NetAccessorException, Message:The
> > > >host/address 'schemas.xmlsoap.org' could not be resolved.
> > > >
> > > >One of the reason for this is I had shut down my network service. But As
> > > >I have installed my own custom enityResolver then why it is trying to
> > > >access the network. Is there any way to get rid of this error by setting
> > > >any flag or property so that Xerces will not try to access the network.
> > > >
> > > >Thanks.
> > > >Regards,
> > > >Umesh
> > > >--
> > > >Umesh Chandak <um...@gslab.com>
> > >
> >--
> >Umesh Chandak <um...@gslab.com>
> 
> 
-- 
Umesh Chandak <um...@gslab.com>


Re: how to prevent the xerces from accessing the network in case of custom entity resolution

Posted by Alberto Massari <am...@datadirect.com>.
At 15.36 29/05/2007 +0530, Umesh Chandak wrote:
>Thanks for the reply.
>But I am using the SAX2XMLReaderImpl class of the exerces and I don't
>see any such method in this class.

You need to use 
setFeature(XMLUni::fgXercesDisableDefaultEntityResolution, true)

Alberto


>Thanks.
>Regards,
>Umesh
>On Tue, 2007-05-29 at 11:15 +0200, Alberto Massari wrote:
> > Hi Umesh,
> > you neeed to use setDisableDefaultEntityResolution(true)
> >
> > void AbstractDOMParser::setDisableDefaultEntityResolution (  const
> > bool  newValue  )
> >
> > 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
> >
> > Parameters:
> > newValue The state to set
> >
> > Alberto
> >
> > At 14.38 29/05/2007 +0530, Umesh Chandak wrote:
> > >Hi All,
> > >
> > >I have installed my custom entity resolver like this
> > >XMLEntityResolver * currentEntityResolver =
> > >parser->getXMLEntityResolver();
> > >XMLImportIncludeResolverWrapper* r = new
> > >XMLImportIncludeResolverWrapper(currentEntityResolver,
> > >entityResolver,entityResolverArg, errors) ;
> > >parser->setXMLEntityResolver(r);
> > >
> > >But if my custom entityResolver returns NULL then I got the error
> > >An exception occurred! Type:NetAccessorException, Message:The
> > >host/address 'schemas.xmlsoap.org' could not be resolved.
> > >
> > >One of the reason for this is I had shut down my network service. But As
> > >I have installed my own custom enityResolver then why it is trying to
> > >access the network. Is there any way to get rid of this error by setting
> > >any flag or property so that Xerces will not try to access the network.
> > >
> > >Thanks.
> > >Regards,
> > >Umesh
> > >--
> > >Umesh Chandak <um...@gslab.com>
> >
>--
>Umesh Chandak <um...@gslab.com>


Re: how to prevent the xerces from accessing the network in case of custom entity resolution

Posted by Umesh Chandak <um...@gslab.com>.
Thanks for the reply.
But I am using the SAX2XMLReaderImpl class of the exerces and I don't
see any such method in this class.

Thanks.
Regards,
Umesh 
On Tue, 2007-05-29 at 11:15 +0200, Alberto Massari wrote:
> Hi Umesh,
> you neeed to use setDisableDefaultEntityResolution(true)
> 
> void AbstractDOMParser::setDisableDefaultEntityResolution (  const 
> bool  newValue  )
> 
> 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
> 
> Parameters:
> newValue The state to set
> 
> Alberto
> 
> At 14.38 29/05/2007 +0530, Umesh Chandak wrote:
> >Hi All,
> >
> >I have installed my custom entity resolver like this
> >XMLEntityResolver * currentEntityResolver =
> >parser->getXMLEntityResolver();
> >XMLImportIncludeResolverWrapper* r = new
> >XMLImportIncludeResolverWrapper(currentEntityResolver,
> >entityResolver,entityResolverArg, errors) ;
> >parser->setXMLEntityResolver(r);
> >
> >But if my custom entityResolver returns NULL then I got the error
> >An exception occurred! Type:NetAccessorException, Message:The
> >host/address 'schemas.xmlsoap.org' could not be resolved.
> >
> >One of the reason for this is I had shut down my network service. But As
> >I have installed my own custom enityResolver then why it is trying to
> >access the network. Is there any way to get rid of this error by setting
> >any flag or property so that Xerces will not try to access the network.
> >
> >Thanks.
> >Regards,
> >Umesh
> >--
> >Umesh Chandak <um...@gslab.com>
> 
-- 
Umesh Chandak <um...@gslab.com>


Re: how to prevent the xerces from accessing the network in case of custom entity resolution

Posted by Umesh Chandak <um...@gslab.com>.
Hi,
My load grammar function fails when I return NULL from my own entity
resolver class and  xmlri->getResourceIdentifierType() is
XMLResourceIdentifier::ExternalEntity and I had disabled the
fgXercesDisableDefaultEntityResolution.

Thanks.
Regards,
Umesh  

On Tue, 2007-05-29 at 11:15 +0200, Alberto Massari wrote:
> Hi Umesh,
> you neeed to use setDisableDefaultEntityResolution(true)
> 
> void AbstractDOMParser::setDisableDefaultEntityResolution (  const 
> bool  newValue  )
> 
> 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
> 
> Parameters:
> newValue The state to set
> 
> Alberto
> 
> At 14.38 29/05/2007 +0530, Umesh Chandak wrote:
> >Hi All,
> >
> >I have installed my custom entity resolver like this
> >XMLEntityResolver * currentEntityResolver =
> >parser->getXMLEntityResolver();
> >XMLImportIncludeResolverWrapper* r = new
> >XMLImportIncludeResolverWrapper(currentEntityResolver,
> >entityResolver,entityResolverArg, errors) ;
> >parser->setXMLEntityResolver(r);
> >
> >But if my custom entityResolver returns NULL then I got the error
> >An exception occurred! Type:NetAccessorException, Message:The
> >host/address 'schemas.xmlsoap.org' could not be resolved.
> >
> >One of the reason for this is I had shut down my network service. But As
> >I have installed my own custom enityResolver then why it is trying to
> >access the network. Is there any way to get rid of this error by setting
> >any flag or property so that Xerces will not try to access the network.
> >
> >Thanks.
> >Regards,
> >Umesh
> >--
> >Umesh Chandak <um...@gslab.com>
> 
-- 
Umesh Chandak <um...@gslab.com>


Re: how to prevent the xerces from accessing the network in case of custom entity resolution

Posted by Alberto Massari <am...@datadirect.com>.
Hi Umesh,
you neeed to use setDisableDefaultEntityResolution(true)

void AbstractDOMParser::setDisableDefaultEntityResolution (  const 
bool  newValue  )

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

Parameters:
newValue The state to set

Alberto

At 14.38 29/05/2007 +0530, Umesh Chandak wrote:
>Hi All,
>
>I have installed my custom entity resolver like this
>XMLEntityResolver * currentEntityResolver =
>parser->getXMLEntityResolver();
>XMLImportIncludeResolverWrapper* r = new
>XMLImportIncludeResolverWrapper(currentEntityResolver,
>entityResolver,entityResolverArg, errors) ;
>parser->setXMLEntityResolver(r);
>
>But if my custom entityResolver returns NULL then I got the error
>An exception occurred! Type:NetAccessorException, Message:The
>host/address 'schemas.xmlsoap.org' could not be resolved.
>
>One of the reason for this is I had shut down my network service. But As
>I have installed my own custom enityResolver then why it is trying to
>access the network. Is there any way to get rid of this error by setting
>any flag or property so that Xerces will not try to access the network.
>
>Thanks.
>Regards,
>Umesh
>--
>Umesh Chandak <um...@gslab.com>

AW: how to prevent the xerces from accessing the network in case ofcustom entity resolution

Posted by Volker Denneberg <v....@gevabs.de>.
Hi,

I am not too shure about it but you may replace the default net accessor object with your own one that doesnt care about networking:

XMLPlatformUtils::Initialize();  // always
XMLPlatformUtils::fgNetAccessor = new myDummyNetAccessor( ); // in your case

where myDummyNetAccessor is your derivative from XMLNetAccessor. But i think you definitivly need need net access because schemas.xmlsoap.org looks like an URL. Be hure to switch off schema validation if the schema definition is located locally

Regards Volker

-----Ursprüngliche Nachricht-----
Von: Umesh Chandak [mailto:umeshc@gslab.com] 
Gesendet: Dienstag, 29. Mai 2007 11:08
An: c-users@xerces.apache.org
Betreff: how to prevent the xerces from accessing the network in case ofcustom entity resolution

Hi All,

I have installed my custom entity resolver like this 
XMLEntityResolver * currentEntityResolver =
parser->getXMLEntityResolver();
XMLImportIncludeResolverWrapper* r = new
XMLImportIncludeResolverWrapper(currentEntityResolver,
entityResolver,entityResolverArg, errors) ;
parser->setXMLEntityResolver(r);

But if my custom entityResolver returns NULL then I got the error 
An exception occurred! Type:NetAccessorException, Message:The
host/address 'schemas.xmlsoap.org' could not be resolved. 

One of the reason for this is I had shut down my network service. But As
I have installed my own custom enityResolver then why it is trying to
access the network. Is there any way to get rid of this error by setting
any flag or property so that Xerces will not try to access the network. 

Thanks.
Regards,
Umesh
-- 
Umesh Chandak <um...@gslab.com>