- From: Michael Kay <mike@saxonica.com>
- Date: Wed, 02 Nov 2011 21:02:10 +0000
- To: xmlschema-dev@w3.org
Why do you want to use the same type to describe two things that appear on the surface to have quite unrelated structure? What are you hoping to achieve, that you could not achieve by using two completely different and unrelated types? Or to put it another way, why can't you use xs:anyType as the common ancestor of the two types? In what way would your common ancestor differ from xs:anyType? Michael Kay Saxonica On 02/11/2011 20:05, Costello, Roger L. wrote: > Hi Folks, > > I would like to associate this title element with a complexType named property: > > <title>The Implementation of Functional Programming Languages</title> > > Notice that this "property element" has simple content. > > I would like to associate this author element with the same property complexType: > > <author> > <Person> > <name>Simon L. Peyton Jones</name> > </Person> > </author> > > Observe that this property element has complex content. > > Thus, there are property elements with simple content and property elements with complex content. > > How do I define a property complexType such that it can be restricted to simpleContent and extended to complexContent? > > The following works, but I am not happy with it because it uses mixed="true" which I do not want. The<author> element has mixed content. Is there a way to implement this without requiring some property elements to have mixed content? /Roger > > <xs:complexType name="property" abstract="true" mixed="true" /> > > <xs:element name="title" type="titleType" /> > > <xs:complexType name="titleType"> > <xs:simpleContent> > <xs:restriction base="property"> > <xs:simpleType> > <xs:restriction base="xs:string"> > <xs:maxLength value="100" /> > </xs:restriction> > </xs:simpleType> > </xs:restriction> > </xs:simpleContent> > </xs:complexType> > > <xs:element name="author" type="authorType" /> > > <xs:complexType name="authorType" mixed="true"> > <xs:complexContent> > <xs:extension base="property"> > <xs:sequence> > <xs:element ref="Person" /> > </xs:sequence> > </xs:extension> > </xs:complexContent> > </xs:complexType> > >
Received on Wednesday, 2 November 2011 21:02:41 UTC