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

Re: xs:all reuse

From: Karl Stubsjoen <kstubs@gmail.com>
Date: Wed, 2 Jun 2010 21:54:03 -0700
Message-ID: <AANLkTik__CotLGRKYka7XZAujnLBKbU5XIdWFptWv4GB@mail.gmail.com>
To: Kevin Braun <kbraun@obj-sys.com>
Cc: xmlschema-dev@w3.org
Thank you, that worked.

On Wed, Jun 2, 2010 at 6:13 AM, Kevin Braun <kbraun@obj-sys.com> wrote:
> 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 Thursday, 3 June 2010 04:54:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:21 GMT