W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2010

Re: xs:all reuse

From: Kevin Braun <kbraun@obj-sys.com>
Date: Wed, 02 Jun 2010 09:13:39 -0400
Message-ID: <4C065903.6050709@obj-sys.com>
To: Karl Stubsjoen <kstubs@gmail.com>
CC: xmlschema-dev@w3.org
Hi Karl,

Are you aware that you can define named groups for reuse using 
xs:group?  It sounds like that is what you are looking for.

So, you would do something like:
<!-- Define a named group that you can reuse-->
<xs:group name="MyGroup">
<xs:element name="item1"/>
<xs:element name="item2"/>
<xs:element name="item3"/>
<xs:element name="group" type="TypeForGroupElement"/>

<!-- Define a type for your "group" element.  It uses the named group.  
No attributes. -->
<xs:complexType name="TypeForGroupElement">
<xs:group ref="MyGroup">

<!-- Define your original type using the named group -->
<xs:complexType name="MyType">
<xs:group ref="MyGroup"/>
<xs:attributeGroup ref="common"/>
<xs:attribute name="title"/>
<xs:attribute name="name"/>


Objective Systems, Inc.

On 6/1/2010 12:59 PM, Karl Stubsjoen wrote:
> I have a complextype, which looks sort of like this:
> <xs:complexType name="my complext type">
>    <xs:all>
>      <xs:element name="item1"/>
>      <xs:element name="item2"/>
>      <xs:element name="item3"/>
>     <xs:element name="group">
>        <!--
>          this group should refer to to this set of xs:all elements
>          allowing a child, child, child ... relationship
>        -->
>    </xs:element>
>    </xs:all>
>    <xs:attributeGroup ref="common"/>
>    <xs:attribute name="title"/>
>    </xs:attribute name="name"/>
> </xs:complexType>
>   Maybe not possible, but trying to understand. How could I accomplish
> this?  So at the top most level I have an element defined as the type
> "my complex type", which result in this element with attributes:<all
> common attributes>  + title, and name and the elements: item1, item2,
> item3 and group.  I guess I don't understand how to define the set of
> <xs:all>  items as a type which I can then reuse to define  the element
> group.
> Thanks,
> Karl..
Received on Wednesday, 2 June 2010 13:14:21 UTC

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