Re: Shouldn't this restriction be invalid?

Hi Steven,

Steven Bird wrote:

>I'm trying to understand what is going on with the following restriction,
>which originates in [http://www.ukoln.ac.uk/metadata/dcmi/xmlschema/].
>This is valid according to XSV, and invalid according to XML Spy.
>
>>From the documentation, "The SimpleLiteral complexType is defined in
>terms of mixed complexContent. However, the cardinality attributes on
>the xs:any element dictate that this complexType does not permit child
>elements."  Here's the definition of SimpleLiteral:
>
><xs:complexType name="SimpleLiteral">
>  <xs:complexContent mixed="true">
>    <xs:restriction base="xs:anyType">
>      <xs:sequence>
>        <xs:any processContents="lax" minOccurs="0" maxOccurs="0"/>
>      </xs:sequence>
>      <xs:attribute ref="x:lang" use="optional"/>
>    </xs:restriction>
>  </xs:complexContent>
></xs:complexType>
>
>The following type, W3CDTF, is defined as a restriction of SimpleLiteral.
>Note that it specifies simpleContent instead of complexContent.
>
><xs:complexType name="W3CDTF">
>  <xs:simpleContent>
>    <xs:restriction base="SimpleLiteral">
>      <xs:simpleType>
>        <xs:union memberTypes="xs:gYear xs:gYearMonth xs:date xs:dateTime"/>
>      </xs:simpleType>
>      <xs:attribute ref="x:lang" use="prohibited"/>
>    </xs:restriction>
>  </xs:simpleContent>
></xs:complexType>
>
>Is this a legal derived type?  
>
I think this is invalid according to the current spec at [1] which says 
(in the table with the heading "Complex Type Definition with simple 
content Schema Component"):

"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..."

So, if the derived type is a complexType with simpleContent then the 
base type _must_ be a type with simple content which is not the case in 
the above example. However, having said that I'm not sure if there is an 
errata pending (or maybe even released?) about this because I seem to 
remember a problem with this issue. I think the errata relates to the 
section further down [2] which deals with schema component constraints. 
In the section with the heading "Schema Component Constraint: Derivation 
Valid (Restriction, Complex)" point 5 says:

5 The appropriate case among the following must be true:
5.1 If the {content type} of the complex type definition is a simple 
type definition, then one of the following must be true:
5.1.1 The {content type} of the {base type definition} must be a simple 
type definition of which the {content type} is a ·valid restriction· as 
defined inDerivation Valid (Restriction, Simple) (§3.14.6).
5.1.2 The {base type definition} must be mixedand have a particle which 
is ·emptiable· as defined in Particle Emptiable (§3.9.6).

According to 5.1.2 the above example you showed is actually valid 
according to the Schema component constaints. However, since it's not 
valid according to the XML Representation constraints you can never 
create a schema _document_ which is valid with this example.
 
[1] http://www.w3.org/TR/xmlschema-1/#declare-type
[2] http://www.w3.org/TR/xmlschema-1/#coss-ct

>Why don't the validators agree?
>
My guess would be because the spec isn't clear on this issue. If there 
is an errata out that fix this problem then validators will probably 
change accordingly.

Cheers,
/Eddie

Received on Wednesday, 2 October 2002 20:23:49 UTC