confusing simple content restriction

Dear all,

there is a lot of disussion in this mailing list about the use of an inlined
simple type definition in simple content restrictions, e.g.:

<xs:complexType name="B">
  <xs:complexContent>
    <xs:extension base="xs:string/>
  </xs:complexContent>
</xs:complexType>

<xs:complexType name="M">
  <xs:simpleContent>
    <xs:restriction base="B">
      <xs:minLength="3"/>
    </xs:restriction>
  </xs:simpleContent>
</xs:complexType>

<xs:complexType name="D">
  <xs:simpleContent>
    <xs:restriction base="M">
      <xs:simpleType>                       <!-- here is the inlined simple
type -->
        <xs:restriction base="xs:Name">
          <maxLength value="10"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:restriction>
  </xs:simpleContent>
</xs:complexType>

In a previous correspondance
(http://lists.w3.org/Archives/Public/xmlschema-dev/2002Jan/0082.html) Henry Thompson says:

"Since the base type def is really _two_ type defs (the complex one
itself, and the simple one it has for its content) you need two type
definition references: one to the base complex type def, and one to
the simple type def which restricts the base complex type def's
content type.  The outer restriction carries the former, and also may
contain restricting attribute declarations.  The inner simple type and
its restriction are for the latter."

I still do not understand the exact meaning of and need for the inlined
inner type definition:

- The content type of a base type can by restricted without an inlined
simple type. Facets are valid children of the restriction element. The facets are
applied to the content type of the base type (cf. above derivation of the
type M from B).

- What is the content type of the derived type D? I guess I should be a new
simple type that has all facets that it inherits from its base type, i.e.
<minLength value="3"/> and all the facets that are imposed on the inlined simple
type, i.e. <maxLength="10"/>. In addition it must be checked that the
inlined simple type is a subtype of the content type of the base type of D. In the
example above the content type of D would be an xs:Name with the minLength
and maxLength facets applied.

(Would it be an error if the base type of the inlined simple type would be
xs:float, i.e. not a subtype of xs:string?)

This rule seems rather complicated to me and I do not see a real need for
the inlined simple type. Did I miss something?

Thanks for your attention,
--Stefan

Received on Monday, 5 August 2002 05:25:53 UTC