Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: emptiable content in particle inheritance

From: "Michael Kay" <mike@--------.--->
To: "'Michael Kay'" <mike@--------.--->, "'Tobias Koenig'" <tobias.koenig@---------.--->, <xmlschema-dev@--.--->
Date: 2/2/2009 7:18:00 PM
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 that
seems to be the weight of opinion...

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: xmlschema-dev-request@w... 
> [mailto:xmlschema-dev-request@w...] On Behalf Of Michael Kay
> Sent: 02 February 2009 18:01
> To: 'Tobias Koenig'; xmlschema-dev@w...
> Subject: RE: emptiable content in particle inheritance
> 
> 
> 
> I remember having some trouble with <xsd:element name="e1" 
> minOccurs="0"
> maxOccurs="0"/> appearing as a branch of a choice, but I 
> forget the details.
> I've found a comment in the code that refers to test mgH014, 
> which I see is your schema (1), but I'm now far from 
> convinced about it.
> 
> Saxon is treating the choice as not emptiable - the only 
> valid content is the single element <e2/> - and Xerces 
> appears to agree. But at present I can't see from the spec 
> why that should be. The spec appears to say that the content 
> is valid against a choice model group if it is valid against 
> any branch of the choice, and the empty sequence certainly 
> appears to be valid against <xsd:element name="e1" 
> minOccurs="0" maxOccurs="0"/>. So I'm confused. I think I 
> might have been over-influenced by this published test result 
> and by the fact that other processors accept it as valid.
> 
> Michael Kay
> http://www.saxonica.com/
> 
> > 
> > there are the two schemas
> > 
> > 1)
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> >   <xsd:element name="doc" type="foo"/>
> >     <xsd:complexType name="foo">
> >       <xsd:complexContent>
> >         <xsd:restriction base="bar">
> >           <xsd:choice>
> >             <xsd:element name="e1" minOccurs="0" maxOccurs="0"/>
> >             <xsd:element name="e2"/>
> >           </xsd:choice>
> >         </xsd:restriction>
> >       </xsd:complexContent>
> >     </xsd:complexType>
> >     <xsd:complexType name="bar">
> >       <xsd:choice>
> >         <xsd:element name="e1"/>
> >         <xsd:element name="e2"/>
> >       </xsd:choice>
> >    </xsd:complexType>
> > </xsd:schema>
> > 
> > 2)
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> >  <xs:complexType name="base">
> >    <xs:sequence>
> >     <xs:element name="e1" type="xs:string" />
> >    </xs:sequence>
> >  </xs:complexType>
> >  <xs:complexType name="derived">
> >         <xs:complexContent>
> >         <xs:restriction base="base">
> >             <xs:choice minOccurs="0">
> >                 <xs:element name="e1" type="xs:string" />
> >             </xs:choice>
> >         </xs:restriction>
> >         </xs:complexContent>
> >  </xs:complexType>
> > </xs:schema>
> > 
> > In both cases a complex type with emptiable particle derives by 
> > restriction from a complex type with non-emptiable 
> particle. However 
> > the first schema is valid according to xml schema test suite (and 
> > saxon validator) but the second is not. So what is the real 
> issue in 
> > the second schema? That a choice particle is inherited from an 
> > sequence particle?
> > 
> > Thanks in advance
> > 
> > Ciao,
> > Tobias
> > 
> 
> 


From g.ken.holman@g... Mon Feb 02 20:43:40 2009
Received: from maggie.w3.org ([193.51.208.68])
	by frink.w3.org with esmtp (Exim 4.63)
	(envelope-from <g.ken.holman


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