W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2009

Re: Why xsi:type works only inwards, not outwards?

From: Kevin Braun <kbraun@obj-sys.com>
Date: Thu, 03 Dec 2009 15:45:29 -0500
Message-ID: <4B182369.9010108@obj-sys.com>
To: Krzysztof FF <Krzysztof.Finowicki@tessel.pl>
CC: xmlschema-dev@w3.org


On 12/3/2009 3:08 PM, Krzysztof FF wrote:
> Kevin Braun wrote:
>   
>> Hi,
>>
>> One brief comment embedded below.
>>
>> Kevin
>>
>> On 12/3/2009 11:13 AM, Krzysztof FF wrote:
>>     
>>> Hi all,
>>>
>>>       
>> [...]
>>     
>>> BUT USING xsi:type on both levels is illegal:
>>>
>>> <sys:Entity xsi:type="RoomType">
>>> <!-- namespaces omitted for brevity -->
>>>     <sys:category xsi:type="RoomCategoryType">living</sys:category>
>>> </sys:Entity1>
>>>
>>>   
>>>       
>> I believe this would be invalid because you have indicated that 
>> sys:Entity is actually a "RoomType", but then you give a sys:category 
>> for the child, which is not legal according to "RoomType" - you need an 
>> "app:roomCategory" element.  Once you tell it the type the element 
>> should be validated against, you have to follow the model for that type.
>>
>>     
>
> But I told that sys:category is actually RoomCategoryType using xsi:type, so
> why id doesn't works? Why actual type is not exposed, only plain one?
>   
When you told it the type for sys:Entity was RoomType, you were telling 
it you are going to provide data that would validate against RoomType.  
In other words, you are essentially saying "don't accept a sys:category 
element, be more restrictive and demand an app:roomCategory element".  
Yes, you specified "RoomCategoryType" for the sys:category element, but 
RoomType doesn't allow just *any* element of RoomCategoryType, it 
requires an app:roomCategory element (or an element in its substitution 
group).  The definition of RoomType specifies not only the type of 
elements that should appear, but also the names for those elements.

I hope that helps.

-Kevin
Received on Thursday, 3 December 2009 20:48:09 GMT

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