Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: emptiable content in particle inheritance

From: "G. Ken Holman" <gkholman@----------------.--->
To: <xmlschema-dev@--.--->
Date: 2/2/2009 4:43:00 AM
At 2009-02-02 19:18 +0000, Michael Kay wrote:

>Just to reinforce this, 4 validators (Saxon-SA, Xerces, XSV, and Ms .NET)
>agree that the instance document
>
><doc/>
>
>is valid against the schema
>
><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>         <xsd:element name="doc" type="foo"/>
>         <xsd:complexType name="foo">
>           <xsd:sequence>
>                 <xsd:element name="e1" minOccurs="0" maxOccurs="0"/>
>           </xsd:sequence>
>         </xsd:complexType>
></xsd:schema>
>
>but invalid against
>
><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>         <xsd:element name="doc" type="foo"/>
>         <xsd:complexType name="foo">
>           <xsd:choice>
>                 <xsd:element name="e1" minOccurs="0" maxOccurs="0"/>
>                 <xsd:element name="e2"/>
>           </xsd:choice>
>         </xsd:complexType>
></xsd:schema>
>
>I'm having great difficulty seeing how it can be valid against a particle P
>but invalid against a choice of which P is one of the options.

But if you took the perspective that the particle doesn't even exist 
because of the minOccurs="0" and maxOccurs="0", then the above two 
schemas would be equivalent to the schemas written as:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <xsd:element name="doc" type="foo"/>
         <xsd:complexType name="foo">
           <xsd:sequence>
           </xsd:sequence>
         </xsd:complexType>
</xsd:schema>

.... and ....

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <xsd:element name="doc" type="foo"/>
         <xsd:complexType name="foo">
           <xsd:choice>
                 <xsd:element name="e2"/>
           </xsd:choice>
         </xsd:complexType>
</xsd:schema>

Which would, in fact, be valid against the first schema but not the second.

>But that seems to be the weight of opinion...

I think it is explicit.

http://www.w3.org/TR/xmlschema-1/#declare-element states:

   "the corresponding schema components are as follows (unless
    minOccurs=maxOccurs=0, in which case the item corresponds
    to no component at all):"

Which tells me that my rewriting of the schemas is equivalent to the 
original ... there is no schema component for a declaration with 
minOccurs=maxOccurs=0, which means that when <doc/> is being tested 
with the second schema, there is no schema component e1 with 
minOccurs="0" for it to match against.

Of course there would be if maxOccurs="1" or any other value and 
minOccurs="0", in which case it would have matched.

I hope this helps.

. . . . . . . . . . . Ken


--
Upcoming hands-on XSLT, UBL & code list hands-on training classes:
Brussels, BE 2009-03;  Prague, CZ 2009-03, http://www.xmlprague.cz
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@C...
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


From petexmldev@c... Mon Feb 02 20:48:45 2009
Received: from maggie.w3.org ([193.51.208.68])
	by frink.w3.org with esmtp (Exim 4.63)
	(envelop


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent