RE: new to schema: Unique Particle Attribution

Do the simpleQuestionItems & complexQuestionItems need to be groups?  Here
is something you may try. Also if you're referencing the title, content and
weight, they must be elements or you can just make them Types (Simple types)
. simple & complex.. can contain elemets of this types.

1) Create various question elements and a group for all acceptable questions


<xs:element name="simpleQuestionItems">
    <xs:complexType>
	<xs:sequence>
               <xs:element name="title" type="titleType" minOccurs="0"
maxOccurs="1"/>
               <xs:element name="content" type="contentType" />
               <xs:element name="weight" type="weightType" />	
           </xs:sequence>
    <xs:complexType>
</xs:element name>

<xs:element name="complexQuestionItems">
    <xs:complexType>
	<xs:sequence>
		...
	</xs:sequence>
    <xs:complexType>
</xs:element name>

<xs:group name="listOfQuestions">
     <xs:choice>
	<xs:element ref="simpleQuestionItems"/>
	<xs:element ref="complexQuestionItems"/>
    </xs:choice>
</xs:group>

2) create question element that can have mixture of the question types
<xs:element name="question">
    <xs:complexType>
	<xs:sequence>
		<xs:group ref="listOfQuestions"/>
	</xs:sequence>
    <xs:complexType>
</xs:element name>

good luck,
-Farid


> -----Original Message-----
> From: Kostas Karadamoglou [mailto:karadamoglou_k@yahoo.gr]
> Sent: Tuesday, April 05, 2005 7:54 PM
> To: xmlschema-dev@w3.org
> Subject: new to schema: Unique Particle Attribution
> 
> 
> 
> Hi all,
> 
> I am new to xml schema and to this mailing list (if misuse it please 
> inform me).
> 
> I would like to write an element (question) which does the following:
> 
> question can have either:
> 
> title(optional), content and weight
> 
> or:
> 
> title, content(optional), weight(optional) and question
> 
> I tried to implement the above rules in an xml schema but I got a 
> "Unique Particle Attribution". Below I provide you with the 
> xml fragment 
> that implement the rules. Can you tell me how I can implement 
> these rules?
> 
>     <xs:group name="simpleQuestionItems">
>         <xs:sequence>
>             <xs:element ref="title" minOccurs="0" maxOccurs="1"/>
>             <xs:element ref="content"/>
>             <xs:element ref="weight"/>
>         </xs:sequence>
>     </xs:group>
> 
>     <xs:group name="complexQuestionItems">
>         <xs:sequence>
>             <xs:element ref="title"/>
>             <xs:element ref="content" minOccurs="0" maxOccurs="1"/>
>             <xs:element ref="weight" minOccurs="0" maxOccurs="1"/>
>             <xs:element ref="question" minOccurs="1" 
> maxOccurs="unbounded"/>
>         </xs:sequence>
>     </xs:group>
> 
>     <xs:element name="question">
>         <xs:complexType>
>             <xs:choice>
>                 <xs:group ref="simpleQuestionItems"/>
>                 <xs:group ref="complexQuestionItems"/>
>             </xs:choice>
>             <xs:attribute name="required" type="xs:boolean" 
> default="false"/>
>         </xs:complexType>
>     </xs:element>
> 
> 
> 


>From E-mail Administrator
ATTENTION PLEASE: Do you have our new e-mail addresses?
The current L-3 standard is First.Last @ L-3com.com
E-mail addressed to First.Last @ te.L-3com.com will no longer be delivered.
Please update your address book using the "From" address on this email.

Received on Wednesday, 6 April 2005 16:30:03 UTC