W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2006

Re: disallowed substitutions

From: Eduardo Gutentag <Eduardo.Gutentag@Sun.COM>
Date: Fri, 28 Jul 2006 11:22:39 -0700
To: Zafar Abbas <Zafar.Abbas@microsoft.com>
Cc: xmlschema-dev@w3.org
Message-id: <44CA55EF.6050107@sun.com>

I got the following answer internally:

The schema is correct --- there's no error in this schema,
and the instance is invalid, because it uses <Member1 />
when it's not allowed to substitute <Head />.

The reason why this element substitution is not allowed is
as follows:

=========
"Schema Component Constraint: Substitution Group OK
(Transitive)" 2.3 says for <Member1/> to substitute <Head/>,
the inheritance relationship between its types ("Type" and
"derivedFromType") must not intersect with  "Type"s {prohibited
substitution}, which is "block".

This "Substitution Group OK (Transitive)" rule is invoked from
"Validation Rule: Element Sequence Locally Valid (Particle)".
=========

But the author of the above response wisely adds that he would
not be surprised if he is wrong. "With the schema spec,
you just can't take anything for granted."



On 07/26/2006 10:31 AM, Zafar Abbas wrote:
 > I was going through the recent submission in to the Schema test collection by SUN and found this issue worth posting on this forum:
 >
 > Issue:
 > There are two global elements, one in the substitution group of the other. The type of the Head element has block=restriction. The substitution group member has a type derived by restriction from the Head element's type.
 >
 > What is the value of {disallowed substitutions} in this case for the Head element? By reading the spec [1], it seems that it should be EMPTY (and Member1 should be allowed to substitute) since [disallowed substitutions} are only determined by -block- attributes on the element declaration and not its type.
 >
 >
 >   <xsd:element name="Head" type="Type"/>
 >   <xsd:element name="Member1" type="derivedFromType" substitutionGroup="Head"/>
 >
 >   <xsd:complexType name="Type" block="restriction"/>
 >
 >   <xsd:complexType name="derivedFromType">
 >       <xsd:complexContent>
 >           <xsd:restriction base="Type"/>
 >       </xsd:complexContent>
 >   </xsd:complexType>
 >
 >
 >
 > [1] http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/structures-with-errata.html#Element_Declaration_details
 >
 >
 > Thanks,
 > Zafar Abbas
 >
 >
 >

-- 
Eduardo Gutentag        |    e-mail: eduardo.gutentag@Sun.COM
Technology Director     |    Phone:  +1 510 550 4616 (internal x31442)
Corporate Standards     |    Sun Microsystems Inc.
              W3C AC Rep / W3C AB / OASIS BoD
Received on Friday, 28 July 2006 18:22:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:55 GMT