Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: when is inheritance from xs:anySimpleType allowed?

From: "Michael Kay" <mike@--------.--->
To: "'Tobias Koenig'" <tobias.koenig@---------.--->, <xmlschema-dev@--.--->
Date: 11/18/2008 4:27:00 PM

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@w... 
> [mailto:xmlschema-dev-request@w...] On Behalf Of Tobias Koenig
> Sent: 18 November 2008 08:59
> To: xmlschema-dev@w...
> 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
> 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent