- From: Michael Kay <mike@saxonica.com>
- Date: Tue, 18 Nov 2008 16:26:15 -0000
- To: "'Tobias Koenig'" <tobias.koenig@trolltech.com>, <xmlschema-dev@w3.org>
I have to say I'm pretty confused by this too. I thought at one time that xs:anySimpleType was abstract - but it seems this isn't the case. Indeed, anySimpleType is the default type for attributes if no other type is given. In XSD 1.1 Part 2, 2.2.1.2 we read: <quote> The mapping from lexical space to value space is unspecified for items whose type definition is ·xs:anySimpleType· or ·xs:anyAtomicType·. Accordingly this specification does not constrain processors' behavior in areas where this mapping is implicated, for example checking such items against enumerations, constructing default attributes or elements whose declared type definition is ·xs:anySimpleType· or ·xs:anyAtomicType·, checking identity constraints involving such items. Note: The Working Group expects to return to this area in a future version of this specification. </quote> So it's the default type for attributes, but if you use it in a unique or key constraint, the comparison semantics are undefined... In XSD 1.1 Pt2 3.4.2.2 the rules for {content type}.{simple type definition} clause 2 seem to indicate that it's possible to use facets to restrict from xs:anySimpleType, but I really can't see how such facets would work. But then 3.16.1 says: <quote> As described in Type Definition Hierarchy (§2.2.1.1), every simple type definition is a ·restriction· of some other simple type (the {base type definition}), which is ·xs:anySimpleType· if and only if the type definition in question is ·xs:anyAtomicType· or a list or union type definition which is not itself derived by restriction from a list or union respectively. </quote> (which at the very least is misleading in encouraging you to believe that it's only restating what has already been said elsewhere). And 3.16.1 further says, more clearly <quote> ·xs:anySimpleType· or ·xs:anyAtomicType· must not be named as the {base type definition} of any user-defined atomic simple type definitions: as they allow no constraining facets, this would be incoherent. </quote> (I used to think that "incoherent" was a technical term. I no longer believe this to be the case. It just means "this wouldn't make any sense".) So I think the situation is: * anySimpleType can be used as a concrete type, but it's not at all clear what it means * you can't derive a user-defined type by restriction from anySimpleType Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: xmlschema-dev-request@w3.org > [mailto:xmlschema-dev-request@w3.org] On Behalf Of Tobias Koenig > Sent: 18 November 2008 08:59 > To: xmlschema-dev@w3.org > Subject: when is inheritance from xs:anySimpleType allowed? > > > Hej, > > in which case is it allowed to derive a simpleType or > complexType from xs:anySimpleType? > > I found the following cases: > > <xs:simpleType name="t1"> > <xs:restriction base="xs:anySimpleType" /> > </xs:simpleType> > > <xs:complexType name="ct1"> > <xs:simpleContent> > <xs:extension base="xs:anySimpleType" /> > </xs:simpleContent> > </xs:complexType> > > <xs:complexType name="ct2"> > <xs:simpleContent> > <xs:restriction base="ct1" > > </xs:restriction> > </xs:simpleContent> > </xs:complexType> > > Are they all valid? > > Ciao, > Tobias >
Received on Tuesday, 18 November 2008 16:27:02 UTC