W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2011

Another XML Schema quiz -- what is the base type for a simpleType that is part of a simpleType dependency chain?

From: Costello, Roger L. <costello@mitre.org>
Date: Thu, 28 Apr 2011 14:50:13 -0400
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <9E51F88D5247B648908850C35A3BBB5005393AE895@IMCMBX3.MITRE.ORG>
Hi Folks,

Consider this simpleType:

<xs:simpleType name="A">
     <xs:restriction base="B">
         -- facets --
    </xs:restriction>
</xs:simpleType>


You see that simpleType A uses simpleType B.

Suppose that simpleType B uses simpleType C, which uses simpleType D.

 A --> B --> C --> D

Here is simpleType D:

<xs:simpleType name="D">
     <xs:restriction base="xs:integer">
         -- facets --
    </xs:restriction>
</xs:simpleType>

Quiz: Is simpleType A a restriction of xs:integer?

Scroll down to see the answer ...






























Answer: not necessarily!

Suppose that simpleType C is this:

<xs:simpleType name="C">
     <xs:list itemType="D" />
</xs:simpleType>

So, simpleType A is a list type, not an xs:integer type.

Summary: If there is a list simpleType anywhere up the dependency chain then that alters things - the base stops at the list type. Any simpleTypes higher up from the list type is impacting the list simpleType, not simpleType A.

/Roger
Received on Thursday, 28 April 2011 18:50:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 28 April 2011 18:50:41 GMT