Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: "Pete Cordell" <petexmldev@--------------.--->
To: "Guillaume Lebleu" <gl@---------.--->
Date: 3/9/2007 10:30:00 AM
I'm probably missing the point, but in this case what you have here seems to 
be more of a complex type issue.

With:

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

 <xsd:complexType name="Car">
    <xsd:complexContent>
       <xsd:restriction base="Obj">
          <xsd:sequence>
             <xsd:element ref="CarId"/>
          </xsd:sequence>
       </xsd:restriction>
    </xsd:complexContent>
 </xsd:complexType>

because ObjId and CarId have different names, I don't think they can ever be 
considered to be related, even if they share similar types.  If instead of

   <xsd:element ref="CarId"/>

you had:

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

then there might be some scope for this to work.

Does the following schema snippet not work for you?:

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

<xsd:complexType name="Car">
    <xsd:complexContent>
       <xsd:extension base="Obj">
          <xsd:sequence>
             ...
          </xsd:sequence>
       </xsd:extension>
    </xsd:complexContent>
 </xsd:complexType>

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================

----- Original Message ----- 
From: "Guillaume Lebleu" <gl@b...>
To: "C. M. Sperberg-McQueen" <cmsmcq@a...>
Cc: <xmlschema-dev@w...>
Sent: Thursday, March 08, 2007 2:52 PM
Subject: Re: SimpleType as valid derivation of abstract type in 1.1 ?


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



From petexmldev@t... Fri Mar 09 10:42:39 2007
Received: from aji.w3.org ([133.27.228.225])
	by frink.w3.org with esmtp (Exim 4.50)
	id 1HPcYY-00


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent