Re: troubles designing schema

Hi Eddie,

You can define an unique constraint on the BasicGFFSequenceFeature 
element to check that the moby:articleName of the moby:String, 
moby:Float or moby:Integer are unique and couple that with defining the 
exact number of occurances for these elements in the content model, 
something like below:

   <xs:element name="BasicGFFSequenceFeature">
     <xs:complexType>
       <xs:sequence>
         <xs:element ref="moby:multi_key_value_pair"/>
         <xs:choice maxOccurs="9" minOccurs="9">
           <xs:element ref="moby:String"/>
           <xs:element ref="moby:Float"/>
           <xs:element ref="moby:Integer"/>
         </xs:choice>
       </xs:sequence>
     </xs:complexType>
     <xs:unique name="test">
       <xs:selector xpath="moby:String|moby:Float|moby:Integer"/>
       <xs:field xpath="@moby:articleName"/>
     </xs:unique>
   </xs:element>

Hope that helps,
George
------------------------
George Cristian Bina
http://www.oxygenxml.com

Eddie Kawas wrote:
> Hi,
> 
> I have an XML document that has elements in it that have the
> same tagname, but different mandatory values for the
> attributes. I am having one heck of a time trying to design
> a schema for these types of documents.
> 
> An example of the type of xml I am trying to develop a
> schema for is below:
> 
> <moby:BasicGFFSequenceFeature>
>     <moby:multi_key_value_pair
> moby:articleName="column9_tag_value" moby:id=""
> moby:namespace="">
>         <moby:String moby:articleName="value" moby:id=""
> moby:namespace=""/>
>         <moby:String moby:articleName="key" moby:id=""
> moby:namespace=""/>
>     </moby:multi_key_value_pair>
>     <moby:String moby:articleName="reference" moby:id=""
> moby:namespace=""/>
>     <moby:String moby:articleName="source" moby:id=""
> moby:namespace=""/>
>     <moby:String moby:articleName="method" moby:id=""
> moby:namespace=""/>
>     <moby:Integer moby:articleName="start" moby:id=""
> moby:namespace=""/>
>     <moby:Integer moby:articleName="stop" moby:id=""
> moby:namespace=""/>
>     <moby:Float moby:articleName="score" moby:id=""
> moby:namespace=""/>
>     <moby:String moby:articleName="strand" moby:id=""
> moby:namespace=""/>
>     <moby:String moby:articleName="frame" moby:id=""
> moby:namespace=""/>
>     <moby:String moby:articleName="phase" moby:id=""
> moby:namespace=""/>
> </moby:BasicGFFSequenceFeature>
> 
> As you can see, the tagname is repetitive, but the
> articleNames, which are fixed, are different. Moreover, the
> number of elements is important as well, so you would always
> see all of the elements together or not at all.
> 
> Can this be done? If so, how? What am I missing?
> 
> Thanks way in advance for any insight.
> 
> Eddie Kawas
> 
> 
> 
> 
> 

Received on Wednesday, 29 June 2005 03:25:21 UTC