Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XML Schema: inheritance with variable order of childs >Thread Next - Re: XML Schema: inheritance with variable order of childs Re: XML Schema: inheritance with variable order of childsTo: 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/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
