W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2001

RE: schemas: can I restrict an elem's content based on att value?

From: <Noah_Mendelsohn@lotus.com>
Date: Fri, 5 Jan 2001 16:08:03 -0500
To: "Arnold, Curt" <Curt.Arnold@hyprotech.com>
Cc: imranr@wolfram.com, www-xml-schema-comments@w3.org, xml-dev@lists.xml.org
Message-ID: <OF366548BC.180C0B67-ON852569CB.0074A1C4@lotus.com>
Curt Arnold writes:

>> Suprisingly, whether the type asserted by 
>> xsi:type has to be related to the declared 
>> type of the element is not explicitly stated 
>> in the Structure Draft.

Actually the specification is clear on this point, I think.  The type 
asserted by xsi:type must indeed be either an extension or restriction (if 
not the same).  From [1] (in the description of element declaration 
components):

"The supplied values for {disallowed substitutions} determine whether an 
element declaration appearing in a content model will be prevented from 
additionally validating elements (a) with an xsi:type (2.6.1) that 
identifies an extension or restriction of the type of the declared 
element, and/or (b) from validating elements which are in the substitution 
group headed by the declared element. If {disallowed substitutions} is 
empty, then all derived types and substitution group members are allowed."

The last sentence is critical in establishing that the loosest possible 
constraint still requires that only derivations be supplied.  Hope this 
helps. 

[1] http://www.w3.org/TR/xmlschema-1/#Element_Declaration_details

------------------------------------------------------------------------
Noah Mendelsohn                                    Voice: 1-617-693-4036
Lotus Development Corp.                            Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
----------------------------------------------------------------------
Received on Friday, 5 January 2001 16:18:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:49 GMT