Re: how to express union in XQuery

> 	Can anybody tell me how can I express union in XQuery ?
> 	Thanks in advance.

In http://www.w3.org/TR/xmlschema-1/index.html#Model_Groups you can see this 
text.

> 3.8.1 The Model Group Schema Component
>
> The model group schema component has the following properties:

> Schema Component: Model Group
> {compositor}
>       One of all, choice or sequence. 
> {particles}
>       A list of particles 
> {annotation}
>       Optional. An annotation.
>
> specifies a sequential (sequence), disjunctive (choice) or conjunctive
> (all) interpretation of the {particles}. This in turn determines whether 
> the element information item [children] ·validated· by the model group must:
>
>    * (sequence) correspond, in order, to the specified {particles};
>    * (choice) corresponded to exactly one of the specified {particles};
>    * (all) contain all and only exactly zero or one of each element 
>        specified in {particles}. The elements can occur in any order. In 
>        this case, to reduce implementation complexity, {particles} is 
>        restricted to contain local and top-level element declarations only, 
>         with {min occurs}=0 or 1, {max occurs}=1.

You are asking for the compositor <choice>. 

If you would use 
<element name="myelement">
  <complexType>
     <sequence>
        <element name="el1" type="string"/>
        <element name="el3" type="string"/>
        <element name="el4" type="string"/>
     </sequence>
  </complexType>
</element>

to make appear all of elements el1, el2 and el3 in myelement, with

<element name="myelement">
  <complexType>
     <choice>
        <element name="el1" type="string"/>
        <element name="el3" type="string"/>
        <element name="el4" type="string"/>
     </choice>
  </complexType>
</element>

just one of then could be in the element myelement.

I hope to be right and it help you :-)

Received on Thursday, 1 November 2001 08:42:19 UTC