Re: xs:all reuse

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:all>
<xs:element name="item1"/>
<xs:element name="item2"/>
<xs:element name="item3"/>
<xs:element name="group" type="TypeForGroupElement"/>
</xs:all>
</xs:group>

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

<!-- 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"/>
</xs:complexType>

HTH,
Kevin

-- 
Objective Systems, Inc.
REAL WORLD ASN.1 AND XML SOLUTIONS
http://www.obj-sys.com



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