W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2001

Re: Deriving a simple type from a complex type

From: Jeff Rafter <jeffrafter@definedweb.com>
Date: Mon, 19 Mar 2001 00:11:25 -0800
Message-ID: <006101c0b04c$32070da0$f181fea9@lazarus>
To: "Simon Cox" <Simon.Cox@dem.csiro.au>
Cc: <xmlschema-dev@w3.org>

> Is it possible to constrain the character content of a
> mixed complex type to be one of the built-in simple types?

If you had asked three days ago I would point you to
http://lists.w3.org/Archives/Public/xmlschema-dev/2001Jan/0127.html which I
guess is still relevant with the proposed recommendation released on the
16th of this month.  Nevertheless I looked through the new spec:

My first thought no, though I must admit I am little confused-- I found:

  "A mixed {content type} validates elements whose element [children] (i.e.
specifically ignoring
  other [children] such as character information items) conform to the
supplied content model." [1]

  "Schema Component Constraint: Derivation Valid (Extension)... Both {content type}s must be mixed or both must be
element-only." [2]

I picked out these references which seem to agree with my initial thought.
However section 5 of
"Schema Component Constraint: Derivation Valid (Restriction, Complex)" [2]
tripped me up a little. Based on this section I would guess that you could
have a complexType which if "emptiable" would work if you could apply both
the restriction derivation from the complexType and the simpleType-- which I
can't find explicit wording for but I don't think is allowed.  It seems that
you can reduce it to simpleContent:

 <xs:complexType name="fooType" mixed="true">
  <xs:element name="baz" type="xs:string" minOccurs="0"
 <xs:complexType name="barType">
   <xs:restriction base="fooType"/>

because it is emptiable-- but I am not sure how you would (or if you could)
apply a simpleType thereafter.  So I am sticking with my no...

Good Luck,
Jeff Rafter

[1] http://www.w3.org/TR/xmlschema-1/#Complex_Type_Definition_details
[2] http://www.w3.org/TR/xmlschema-1/#coss-ct
Received on Monday, 19 March 2001 03:12:04 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:51 UTC