W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2002

xs:anySimpleType in sFs

From: Eddie Robertsson <erobertsson@allette.com.au>
Date: Fri, 13 Sep 2002 10:20:05 +1000
Message-ID: <3D812F35.8090605@allette.com.au>
To: XSD <xmlschema-dev@w3.org>

Hi Henry,

A couple of months ago we had a discussion about the validity of the 
usage of xs:anySimpleType in the sFs if it was to be used for 
validation. I looked at the archives and found this message from you [1]:

--------------------------------8<---------------------------------------
> Henry wrote:
> > Sorry for the confusion -- you're right that the inclusion in the
> > sForS of the 'information only' definitions of the builtin primitive
> > datatypes is problematic. I would note in our defense that the quote
> > above says you can't have anySimpleType as the {base type def} of
> > and _user-defined_ types, but I agree that taken as a user schema
> > doc., the published sForS violates this constraint.
> 
> Could you point out where this constraint is? The only constraint that
> I could find was in the non-normative section 3.14.1 of the Structures
> Rec
> (http://www.w3.org/TR/xmlschema-1/#Simple_Type_Definition_details).
> I can't find a similar restriction in the normative Datatypes Rec...?

You're right, it's non-normative.  None-the-less, the point that
actually trying to build a typedef by restricting aST is incoherent is 
clearly true, so processors would be well-advised to flag any attempt
to do so as an error.

Erratum required, I believe.

--------------------------------8<---------------------------------------

Can you tell me what the status of this erratum is?

The reason I'm asking is because I want to use the sFs to validate 
schema documents using the Xerces parser. Unfortunately, Xerces don't 
allow the usage of xs:anySimpleType in a schema used for validation so I 
had to create a customized version of the sFs to use. I guess this is 
fine but I'd really like to use the "real" sFs and the Xerces people 
claim that the use of xs:anySimpleType in a schema used for validation 
is an error. I understand that they don't want to change since the spec 
is not clear on this issue but hopefully with an erratum document we can 
sort this out. I'm not the only one asking for this function in Xerces 
and below are some corresponance with the Xerces team.

Thanks,
/Eddie


Eddie:

----------------------------------------8<----------------------------------------
Hi,

Henry Thompson just posted a new version of the SchemaForSchemas document 
(http://www.w3.org/2001/XMLSchema.xsd). I ran this through Xerces 2.0.1 and I
got the following four errors:

[1] (1 of 43) Schema problem: Unknown base type 'xs:anySimpleType'
for a type 'string' (For simpleType name="string")

Henry's comment to this bug was: "That's just bogus, it's required to be present
by the REC."

[2] (2 of 43) Schema problem: Facet 'whiteSpace' is not allowed by
this type. (For simpleType name="string")
 
Both [1] and [2] occur for all the simpleTypes that derive from xs:anySimpleType
 
[3] For the complexType "attributeGroupRef" the following errors are
reported:

(40 of 43) Schema problem: Group's occurrence range is not a valid
restriction of base group's occurrence range.  (41 of 43) Schema
problem: Error for type 'attributeGroupRef'.  The particle of the
type is not a valid restriction of the particle of the base.
 
[4] For the complexType "groupRef" the following errors are
reported:
 
(42 of 43) Schema problem: Group's occurrence range is not a valid
restriction of base group's occurrence range.  (43 of 43) Schema
problem: Error for type 'groupRef'.  The particle of the type is not
a valid restriction of the particle of the base.

The only one that isn't a bug is [3] which apparently have just been resolved in
the XML Schema WG. The WG have decided to treet the sFs as a special case where
it's allowed to place facets on xs:anySimpleType so this should be fixed in
Xerces as well.

For more information on this see the follwing emails:

http://lists.xml.org/archives/xml-dev/200206/msg00399.html
http://lists.xml.org/archives/xml-dev/200206/msg00446.html

Cheers,
/Eddie

-----------------------------------------8<--------------------------------------
Xerces:
-----------------------------------------8<--------------------------------------
In schema spec "XML Schema Part 1: Structures", section 3.14.1
"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 your schema, you have
<simpleType name="string">
  <restriction base="xs:anySimpleType">
    ...
While apparently violates the above statement.
If you really want to parse the schema for schemas, you need to remove the 
declarations for all built-in simple types.
-----------------------------------------8<--------------------------------------
David: (User)
-----------------------------------------8<--------------------------------------
What fun!

You reference section 3.14.1 but this section is non normative!.
section 3.14.6 (http://www.w3.org/TR/xmlschema-1/#coss-st) which is normative 
says:
4 If the {base type definition} is not the ·simple ur-type definition·, all of 
the following must be true:
4.1 The definition must be a ·valid restriction· as defined in Derivation Valid 
(Restriction, Simple) (§3.14.6). 

which could be read to say that "Derivation Valid (Restriction, Simple) 
(§3.14.6)." is not followed for types with base=·simple ur-type definition· and 
clearly states that the ·simple ur-type definition· is a valid base type at 
least some of the time.

I thought that the XML schemas schema was by defintion normative i.e valid.

Any XML Schema lawyers around?
-----------------------------------------8<--------------------------------------
Xerces:
-----------------------------------------8<--------------------------------------
> which could be read to say that ...

The first sentense in 3.14.6 is "All simple type definitions (see Simple Type 
Definitions (§3.14)) must satisfy the following constraints." Note 
it's "constraints", so "Derivation Valid (Restriction, Simple) (§3.14.6)." must 
always be satisfied.

Of course "anySimpleType" can be the base type of other types: primitive types; 
list types; union types. But not <restriction base="anySimpleType">.

The schema for schemas was not written to be parsed as a normal schema 
document, or to validate an instance, so its "normativeness" shouldn't be used 
here.

What's said in 3.14.1 is clearly valid, and clearly the intention of the spec. 
3.14.6 also states the base type of an atomic type must be either an atomic 
simple type or a primitive one, but anySimpleType is neither. Even in 
the "normative" schema for schemas:
"These definitions are for information only, the real built-in definitions are 
magic.  Note in particular that there is no type named 'anySimpleType'.  The 
primitives should really be derived from no type at all, and anySimpleType 
should be derived as a union of all the primitives."
Received on Thursday, 12 September 2002 20:19:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:34 GMT