W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2011

Re: How to define a complexType so that derived types can have simple content or complex content?

From: Costello, Roger L. <costello@mitre.org>
Date: Thu, 3 Nov 2011 17:15:17 +0000
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <B5FEE00B53CF054AA8439027E8FE177501BAB2@IMCMBX04.MITRE.ORG>
Michael Kay wrote:

> 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?

I want to categorize all elements as either an Object or a property. An Object is described by properties (i.e., an Object element is complex, with property child elements). The value of a property is either a simple value or an Object.  For example, the value of this property element is a simple value:

<title>The Implementation of Functional Programming Languages</title>

The value of this property element is an Object:

    <author>
        <Person>
            <name>Simon L. Peyton Jones</name>
        </Person>
    </author>

Person is an Object.

So, how do I create a property type such that elements derived from it can have a value that is either simple or an Object?

/Roger
Received on Thursday, 3 November 2011 17:15:58 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:19 UTC