W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2000

Dynamic Array

From: Gwenael Treguier <gwenael_treguier@altavista.fr>
Date: 28 Sep 2000 10:35:48 +0200
Message-ID: <20000928083548.5469.cpmta@c000.muc.cp.net>
To: xmlschema-dev@w3.org
Hi,
I want to describe arrays whose sizes are different.
The only way I found to express Array with XML Schema
is by mean of XPath expression in 'minOccurs' attribut value.
    <xsd:element name='myArray'>
      <xsd:complexType>
        <xsd:element name='Size' type='xsd:short'/> 
        <xsd:element name='myArrayElt' type='xsd:string' minOccurs='Size/text()'/>
      </xsd:complexType>
    </xsd:element>
Before the last change (22/09), I have read that 'maxOccurs'='minOccurs' if 'maxOccurs' omitted.
But now I have to write :
    <xsd:element name='myArray'>
      <xsd:complexType>
        <xsd:element name='Size' type='xsd:short'/> 
        <xsd:element name='myArrayElt' type='xsd:string' minOccurs='Size/text()'
            maxOccurs='Size/text()'/>
      </xsd:complexType>
    </xsd:element>

The first problem is XPath expressions are forbidden in 'minOccurs' and 'maxOccurs' attributes value.

Can Someone tell me if I am in a wrong way or if there is a better solution?

I also use XPath expression to say if an element should appeared depend on another element value.
    <xsd:element name='Description' type='xsd:string'
        minOccurs='Flags/description[text()=1]'
        maxOccurs='Flags/description[text()=1]'/>

The second problem is XPath expressions can have results of different type (Boolean, Double, NodeSet...). So I have to check and then cast explictly expression.

Did Someone encounter this kind of problem?
Bye.


Internet et mail gratuit AltaVista http://www.altavista.fr
Received on Thursday, 28 September 2000 04:35:51 GMT

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