Re: anySimpleType/anyType/ur-type as baseType of a user defined type?

"Aung Aung" <aaung@microsoft.com> writes:

> Spec says 
> In section 3.14.1 of structure spec: "The simple *ur-type definition*
> must not be named as the *base type definition* of any user-defined
> simple types: as it has no constraining facets, this would be
> incoherent."
>  
> In section 2.5.2 of datatyes spec: "[Definition:]   There exists a
> conceptual datatype, whose name is anySimpleType, that is the simple
> version of the ur-type definition from [XML Schema Part 1: Structures].
> anySimpleType can be considered as the *base type* of all *primitive*
> types. The *value space* of anySimpleType can be considered to be the
> *union* of the *value space*s of all *primitive* datatypes."
>  
> That means anySimpleType cannot be used as base type definition of any
> user-defined simple types.
>  
> Q1: why does the normative XSD in datatype spec
> (http://www.w3.org/TR/xmlschema-2/#schema) have <restriction
> base="xs:anySimpleType"> all over the places?

Because these are not user-defined types, they are syntactic
approximations to the built-in types.

> Q2:
> The following should all fail to validate. Correct? Or I am missing
> something?

> 1.
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
>       <xs:simpleType name="ct1">
>             <xs:restriction base="xs:anyType" />
>       </xs:simpleType>
> </xs:schema>

Yes, invalid.

> 2.
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
>       <xs:simpleType name="ct2">
>             <xs:restriction base="xs:anySimpleType" />
>       </xs:simpleType>
> </xs:schema>

Yes, invalid.

> 3.
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
>       <xs:complexType name="ct4">
>             <xs:simpleContent>
>                   <xs:restriction base="xs:anySimpleType" />
>             </xs:simpleContent>
>       </xs:complexType>
> </xs:schema>

Yes, invalid.

But you raise an interesting point -- the above don't actually attempt 
a restriction, just a private renaming.  There's no reason we
shouldn't allow this.  The third case in particular, if it contained
attributes, is something people might reasonably wish to do.

I'll raise a potential erratum on this.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/

Received on Wednesday, 7 November 2001 05:29:45 UTC