W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2003

Re: xsi:type inheritance issues

From: <noah_mendelsohn@us.ibm.com>
Date: Fri, 5 Sep 2003 08:11:33 -0400
To: Razvan Costea-Barlutiu <cbrazvan@laitek.com>
Cc: xmlschema-dev@w3.org
Message-ID: <OF399C8350.96C62046-ON85256D98.00428E1E@lotus.com>

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


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.


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:

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

<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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:03 UTC