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
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:element name='Size' type='xsd:short'/> 
        <xsd:element name='myArrayElt' type='xsd:string' minOccurs='Size/text()'/>
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:element name='Size' type='xsd:short'/> 
        <xsd:element name='myArrayElt' type='xsd:string' minOccurs='Size/text()'

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'

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?

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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:49 UTC