Group elements???

Hi,

I have a question. I want to group elements im schema.
See the segment following of a schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="example">
		<xs:complexType>
		   <xs:sequence>
		        <xs:element name="A" maxOccurs="unbounded"
type="xs:string"/>		      
		        <xs:choice>
				<xs:sequence minOccurs="0" maxOccurs="unbounded">
					<xs:element name="C" type="xs:string"
maxOccurs="unbounded"/>
					<xs:element name="D" type="xs:string"
maxOccurs="unbounded"/>					
				</xs:sequence>
				<xs:sequence minOccurs="0" maxOccurs="unbounded">
					<xs:element name="E" type="xs:string"
maxOccurs="unbounded"/>
					<xs:element name="F" type="xs:string"
maxOccurs="unbounded"/>					
				</xs:sequence>
			</xs:choice>
		   </xs:sequence>
		</xs:complexType>
	</xs:element>
	...
	...
</xs:schema>


The "choice"-Complex appear in many others elements.
In order to make my schema small as possible, I would
like to define the "choice"-Complex only once! I have
two suggestions. But I don't know, which of it is
correct! See the suggestions:

1. suggestion:

<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="example">
		<xs:complexType>
		   <xs:sequence>
		        <xs:element name="A" maxOccurs="unbounded"
type="xs:string"/>
		        <xs:group ref="Other"/>		      		        
		   </xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:group name="Other">
		<xs:choice>
				<xs:sequence minOccurs="0" maxOccurs="unbounded">
					<xs:element name="C" type="xs:string"
maxOccurs="unbounded"/>
					<xs:element name="D" type="xs:string"
maxOccurs="unbounded"/>					
				</xs:sequence>
				<xs:sequence minOccurs="0" maxOccurs="unbounded">
					<xs:element name="E" type="xs:string"
maxOccurs="unbounded"/>
					<xs:element name="F" type="xs:string"
maxOccurs="unbounded"/>					
				</xs:sequence>
			</xs:choice>
	</xs:group>
	...
	...
</xs:schema>


2. suggestion:

<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="example">
		<xs:complexType>
		   <xs:sequence>
		        <xs:element name="A" maxOccurs="unbounded"
type="xs:string"/>
		        <xs:group ref="Other"/>		      		        
		   </xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:group name="Other">
	  <xs:sequence>
		<xs:choice>
				<xs:sequence minOccurs="0" maxOccurs="unbounded">
					<xs:element name="C" type="xs:string"
maxOccurs="unbounded"/>
					<xs:element name="D" type="xs:string"
maxOccurs="unbounded"/>					
				</xs:sequence>
				<xs:sequence minOccurs="0" maxOccurs="unbounded">
					<xs:element name="E" type="xs:string"
maxOccurs="unbounded"/>
					<xs:element name="F" type="xs:string"
maxOccurs="unbounded"/>					
				</xs:sequence>
			</xs:choice>
	  </xs:sequence>
	</xs:group>
	...
	...
</xs:schema>



___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

Received on Thursday, 18 April 2002 04:01:11 UTC