- From: Henry S. Thompson <ht@inf.ed.ac.uk>
- Date: Sat, 05 Jun 2004 11:09:02 +0100
- To: Tait E Larson <telarson@us.ibm.com>
- Cc: "Michael Kay" <mhk@mhk.me.uk>, xmlschema-dev@w3.org
Tait E Larson <telarson@us.ibm.com> writes: > <xs:complexType name="BASE" mixed="true"> > <xs:sequence> > <xs:element name="elemA" type="xs:integer" /> > </xs:sequence> > <xs:attribute name="attrB" type="xs:string" /> > </xs:complexType> > I get the following error when I try to validate this schema or the schema > you provided: > > > src-ct.2: Complex Type Definition Representation Error for type 'SUB'. > When simpleContent is used, the base type must be a complexType whose > content type is simple, or, only if extension is specified, a simple > type. That error message is wrong, as Michael correctly pointed out by reference to the revised REC. But your example is _still_ not valid, because your complex BASE is not *emptiable*. The uncorrected REC contained a contradiction between clause 5.1.2 of Derivation Valid (Restriction, Complex) [1] which said (and still says, although it's now numbered as 5.2.2.2) if a complex type definition derived from a base with complex has simple content: "The {base type definition} must be mixed and have a particle which is ·emptiable· as defined in Particle Emptiable (§3.9.6)." So if elemA had minOccurs="0" you'd be OK. The problem in the uncorrected REC was that it _also_ said, in the definition of the mapping from schema documents to components for Complex Type Definition[s] with simple content [2]: "if the type definition ·resolved· to by the ·actual value· of the base [attribute] is a complex type definition (whose own {content type} _must be a simple type definition, see below_) and the <restriction> alternative is chosen," [emphasis added] This evidently contradicts the first quote. The W3C XML Schema WG decided to resolve the contradiction in favour of _allowing_ such derivations. Accordingly, E1-27 in the errata document [3] and the Proposed Edited Recommendation [4] change the _second_ passage quoted above and add an extra mapping clause to cover the relevant case: "1. If the type definition ·resolved· to by the ·actual value· of the base [attribute] is a complex type definition whose own {content type} is a simple type definition and the <restriction> alternative is chosen, . . . "2. If the type definition ·resolved· to by the ·actual value· of the base [attribute] is a complex type definition whose own {content type} is mixed and a particle which is ·emptiable·, as defined in Particle Emptiable (§3.9.6) and the <restriction> alternative is chosen, . . ." Hope this helps clear things up, ht [1] http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction [2] http://www.w3.org/TR/xmlschema-1/#Complex_Type_Definition_details [3] http://www.w3.org/2001/05/xmlschema-errata.html#e1-27 [4] http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/#Complex_Type_Definition_details -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh Half-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/ [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Saturday, 5 June 2004 06:09:16 UTC