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

Re: SimpleType as valid derivation of abstract type in 1.1 ?

From: Guillaume Lebleu <gl@brixlogic.com>
Date: Thu, 08 Mar 2007 09:52:17 -0500
Message-ID: <45F02321.1080006@brixlogic.com>
To: "C. M. Sperberg-McQueen" <cmsmcq@acm.org>
CC: xmlschema-dev@w3.org

C. M. Sperberg-McQueen wrote:
> Why do you want abstract simple types?
>
I want abstract types that both simpleType or complexType can derive from.

My use case is the following: I want to use XSD to define abstract 
patterns and enforce these patterns. For instance, one pattern is "all 
my Obj have an ObjId"

See below code sample, hope it helps. If you tell me there is no other 
way to do this, then I will submit to the list you mentioned.

Thank you,

Guillaume

<!-- all Obj have an abstract ObjId -->

<xsd:complexType name="Obj">
    <xsd:sequence>
       <xsd:element ref="ObjId"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:element name="ObjId" abstract="true"/>
<xsd:complexType name="ObjId"  abstract="true"/>

<!-- all Car are objects and have a CarId -->

<!-- type CarId is a restriction of ObjId / cannot do this today -->

<xsd:element name="CarId" type="CarId" substitutionGroup="ObjId"/>

<xsd:complexType name="Car">
    <xsd:complexContent>
       <xsd:restriction base="Obj">
          <xsd:sequence>
             <xsd:element ref="CarId"/>
          </xsd:sequence>
       </xsd:restriction>
    </xsd:complexContent>
</xsd:complexType>
Received on Thursday, 8 March 2007 17:52:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:41 UTC