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

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 UTC