Re: Restricting the simpleContent of a complexType

Hi,

>   <xs:complexType name="baseType">
>     <xs:simpleContent>
>       <xs:extension base="xs:string">
>         <xs:attribute ref="x:lang" use="optional"/>
>       </xs:extension>
>     </xs:simpleContent>
>   </xs:complexType>
>
>   <xs:complexType name="RFC1766">
>    <xs:simpleContent>
>     <xs:restriction base="baseType">
>       <xs:simpleType>
>           <xs:restriction base="xs:language"/>
>         </xs:simpleType>
>         <xs:attribute ref="x:lang" use="prohibited"/>
>     </xs:restriction>
>    </xs:simpleContent>
>   </xs:complexType>
>
> It seemed to me this should be OK as xs:language is derived from xs:string. As
> far as I can see, this _seems_ to be acceptable to the XSV (latest release),
> Xerces Java 2 (latest release) and MSXML (probably not quite the most recent
> update), but XML Spy rejects it (complaining that xs:simpleType is unexpected
> at that location in the derived type definition).
>
> I'm inclined to go with the majority vote here, but I would welcome some
> reassurance that this is OK - or, indeed, a clear indication that it is broken!

I would say this is valid as well. According to [1]:

"1 if the type definition ·resolved· to by the ·actual value· of the base
[attribute] is a complex type
 definition (whose own {content type} must be a simple type definition, see below)
and the
 <restriction> alternative is chosen, then starting from either
      1.1 the simple type definition corresponding to the <simpleType> among the
[children] of
            <restriction> if there is one;
      1.2 otherwise (<restriction> has no <simpleType> among its [children]), the
simple type
            definition which is the {content type} of the type definition
·resolved· to by the ·actual value·
            of the base [attribute]
 a simple type definition which restricts that simple type definition with a set of
facet
 components corresponding to the appropriate element information items among the
 <restriction>'s [children] (i.e. those which specify facets, if any), as defined
in Simple Type
 Restriction (Facets) (§3.14.3);
..."

I'd say your example match 1 and then 1.1.

Cheers,
/Eddie

[1] http://www.w3.org/TR/xmlschema-1/#declare-type (In the table under the heading:
"Complex Type Definition with simple content Schema Component", section "{content
type}")

Received on Wednesday, 15 May 2002 20:02:03 UTC