- From: Sandy Gao <sandygao@ca.ibm.com>
- Date: Thu, 16 Nov 2006 10:22:01 -0500
- To: "Michael Kay" <mike@saxonica.com>
- Cc: xmlschema-dev@w3.org
- Message-ID: <OFB171D4C3.712D582D-ON85257228.0051813B-85257228.00546B13@ca.ibm.com>
In 3.4.2 of structures 1.0 "a simple type definition which restricts the simple type definition identified in clause 1.1 or clause 1.2 with a set of facet components corresponding to the appropriate element information items among the <restriction>'s [children] (i.e. those which specify facets, if any), as defined in Simple Type Restriction (Facets) (§3.14.6);" For the attached example, I think this is equivalent to the following definition: <xs:simpleType> <xs:restriction base="xs:anySimpleType"/> </xs:simpleType> Is this simple type definition valid? I think it's normally considered invalid, but I'm having trouble finding constraints that rule this out, other than the non-normative statement in 3.14.1: "... every simple type definition is a ·restriction· of some other simple type (the {base type definition}), which is the ·simple ur-type definition· if and only if the type definition in question is one of the built-in primitive datatypes, or a list or union type definition which is not itself derived by restriction from a list or union respectively." The "if an only if" part would rule out a simple type with {base type definition} anySimpleType and {variety} absent. I think some clarification/fix-up is in order. I can see 2 ways: 1 Make it explicit that the above simple type is ruled out (hence the complex type case). (This may already be the case, as I had always thought the simple type case was not allowed.) 2 Make it explicit that the above simple type is ruled out, but still allow the complex type case (when no facet is specified). To achieve #2, 3.4.2 will need to be updated to say "if no facet is specified, then just use the simple type from the base type; otherwise construct a new one". I like #2, because it makes a class of simple content scenarios possible, where the <restriction> is only meant to restrict attributes and doesn't want to change the simple type. Thanks, Sandy Gao XML Parser Development, IBM Canada (1-905) 413-3255 sandygao@ca.ibm.com xmlschema-dev-request@w3.org wrote on 2006-11-15 05:59:01 PM: > > There are some interesting test cases in the new test suite. One which has > me rather flummoxed for the moment is the Microsoft test (in SimpleType) > stZ007.xsd, the relevant part being: > > <xs:complexType name="t1"> > <xs:simpleContent> > <xs:extension base="xs:anySimpleType" /> > </xs:simpleContent> > </xs:complexType> > > <xs:complexType name="t2"> > <xs:simpleContent> > <xs:restriction base="t1"/> > </xs:simpleContent> > </xs:complexType> > > ... <xs:element name="e2 type="t2"/> > > According to the metadata this is valid, and indeed, I can't see any rules > that it breaks. But I'm having trouble building the component model for t2. > > What {variety} of type is the simpleContent type of t2? It must be a simple > type, and according to the component model for simple types, every simple > type has a {variety} which is one of list, atomic, or union. (The 1.1 spec > clarifies that for anySimpleType, {variety} is absent, and at the same time > confirms that it is present for every other simple type). We also read: > > every simple type definition is a .restriction. of some other simple type > (the {base type definition}), which is the .simple ur-type definition. if > and only if the type definition in question is one of the built-in primitive > datatypes, or a list or union type definition which is not itself derived by > restriction from a list or union respectively. > > In the "Complex Type Definition with simple content Schema Component" > definition, we can see that the {content type} of t2 is "a simple type > definition which restricts [xs:anySimpleType] with an [in this case empty] > set of facet components." But what {variety} of simple type definition is > this? (The 1.1 spec is unchanged in this area). > > If the restriction of t1 had any facets, what would they mean (e.g. a length > facet)? > > Any advice much appreciated! > > Michael Kay > >
Received on Thursday, 16 November 2006 23:46:05 UTC