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

Re: Deriving a simple type from a complex type

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 20 Mar 2001 09:45:01 +0000
To: Simon Cox <Simon.Cox@dem.csiro.au>
Cc: xmlschema-dev@w3.org
Message-ID: <f5bk85krcyq.fsf@cogsci.ed.ac.uk>
Simon Cox <Simon.Cox@dem.csiro.au> writes:

> "Henry S. Thompson" wrote:
> > 
> > Simon Cox <Simon.Cox@dem.csiro.au> writes:
> > 
> > > Is it possible to constrain the character content of a
> > > mixed complex type to be one of the built-in simple types?
> > >
> > > e.g.  if I have declared an anyType
> > >
> > >   <xsd:complexType name="FooType" mixed="true"/>
> > >
> > > can I then derive a type with simple content type="xsd:double"
> > > by restriction from this?  How?
> > 
> > <xs:complexType>
> >  <xs:simpleContent>
> >   <xs:restriction base="FooType">
> >    <xs:simpleType>
> >      <xs:restriction base="xs:double"/>
> >    </xs:simpleType>
> >   </xs:restriction>
> >  </xs:simpleContent>
> > </xs:complexType>
> > 
> > Martin Gudgin was right when he said you can't get a _simple_ type
> > definition by restricting a complex type definition.  Jeff Rafter was
> > on the right track in suggesting that what was wanted was a complex
> > type definition with simple content.
> > 
> > Note that _only_ <xs:restriction> within <xs:simpleContent> is allowed
> > to have both a base attribute and explicit content, as above.
> 
> I tried what you suggest - see schema fragment below, 
> with XMLSpy error message inserted inline. 
> Is this a bug in XMLSpy?  

This is a very tricky case, but I believe Spy is mistaken here.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Tuesday, 20 March 2001 04:45:09 GMT

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