Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XML Schema: inheritance with variable order of childs

From: usenet@--------------.---
To: NULL
Date: 11/3/2007 2:24:00 AM

On 2 Nov, 12:41, Sven <s...@ast.dfs.de> wrote:
>...
> <xs:complexType name="TextItemType">
>   <xs:sequence maxOccurs="unbounded" minOccurs="1">
>     <xs:choice>
>       <xs:element name="Name" type="xs:string" />
>       <xs:element name="Content" type="xs:string" />
>     </xs:choice>
>   </xs:sequence>
> </xs:complexType>

In this simplistic case you could use xs:all; e.g.:

<xs:complexType name="TextItemType">
    <xs:all>
      <xs:element name="Name" type="xs:string" />
      <xs:element name="Content" type="xs:string" />
    </xs:all>
</xs:complexType>

> As I want define different Item types I define a base type Item and
> derive the special content types:

Sadly, xs:all doesn't currently allow you to use derivation.  If the
extra precision that xs:all offers appears valuable you might have to
decide between using xs:all and defining each type separately, or
using the derivation tree schema you present.

BTW - I think the xs:sequence part in your original schema snippet is
a bit out of place.  I think you should be able to use the schema:

<xs:complexType name="TextItemType">
    <xs:choice maxOccurs="unbounded" minOccurs="1">
      <xs:element name="Name" type="xs:string" />
      <xs:element name="Content" type="xs:string" />
    </xs:choice>
</xs:complexType>

HTH,

Pete Cordell
Codalogic Ltd
for XML Schema to C++ data binding visit
 http://www.codalogic.com/lmx/



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