Re: xsi:type inheritance issues

First of all, Jeni's answer is (as usual) correct.  Just to be clear, it 
appears to me in your example that Xerces is correct.  Reasoning:

*  Element sample is of type xsd:anyType

* Type replacement dervives from someOtherType which must directly or 
indirectly derive from xsd:anyType

This, xsi:type="replacement" should be OK, presuming there are no "blocks" 
in place (and that should be a different error in any case)

------------------------------------------------------------------
Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------







Razvan Costea-Barlutiu <cbrazvan@laitek.com>
Sent by: xmlschema-dev-request@w3.org
09/04/03 05:41 AM

 
        To:     xmlschema-dev@w3.org
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        xsi:type inheritance issues



All--

I have a huge problem with xsi:type, as seen by various parsers. I can't 
tell which of the parsers are right or wrong as I see suporters for both, 
arguing that one or the other is right.

Namely:

When using xsi:type in an XML instance, does the specified type HAS to be 
derived from the original type of the element it modifies or not?

XMLSpy complains if the replacing type is not derived from the original 
type. Xerces does not. Is there a flavor to this?

If the schema does not specify a type for the element, can that type be 
replaced by just about anything? E.G:

Schema:
<xs:element name="sample">;
<xs:complexType name="replacement">
                 <xs:extension base="someOtherType">... etc
</xs:complexType>

Instance:
<sample xsi:type="replacement">

Is the above a valid construction? Again, XMLSpy (from 4.3 to 5.0) 
complains that the "replacement" is not derived from the original type of 
"sample". Xerces says it's aok.

Any help is hugely appreciated.
Best regards,
--Razvan Costea Barlutiu

Light Soft.

Received on Friday, 5 September 2003 08:10:39 UTC