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/07/25 15:28:02 UTC

precedence between processContent and nameSpace attribute of wildcard

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


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