W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2001

RE: C type array and struct

From: Ayalew Kassahun <A.Kassahun@InfoRay.NL>
Date: Mon, 5 Feb 2001 12:19:13 +0100
Message-ID: <7FAFD1931B62D411B2890050BAB19FB13A1034@ms1.inforay.nl>
To: xmlschema-dev@w3.org
Cc: Mukund Balasubramanian <mukund@cs.stanford.edu>
Wel what I exactly want is not to bind names (in this case the name "arr")
to the array. In my XML document I want to be able to choose any name to the
array. Could I do something like this 

<xsd:complexType name="MyClass">
     <xsd:sequence>
         <xsd:element type="MyElement" maxOccurs="unbounded"/>
     <xsd:sequence>
     <xsd:attribute name="length" type="xsd:int">
 </xsd:complexType>

Note: I do not want to fix the name of the element - i should be able to use
any name. In addition I want to specify the type to be one a number of
types. My definition of MyClass will then be:-

[Definition] The MyClass element may contain 'length' number of elements of
type A or B or C. The number of elements is given by the 'length' attribute.

What is the XML schema definition for this?

Thanks in advance,
Ayalew



> -----Original Message-----
> From: Mukund Balasubramanian [mailto:mukund@cs.stanford.edu]
> Sent: Saturday, February 03, 2001 1:02 AM
> To: Ayalew Kassahun
> Cc: xmlschema-dev@w3.org
> Subject: Re: C type array and struct
> 
> 
> Hi,
>     I presume that is what you get when you define an element 
> with maxOccurs
> > 1. For example:
> 
> <xsd:complexType name="MyClass">
>     <xsd:sequence>
>         <xsd:element name="arr" type="MyElement" 
> maxOccurs="unbounded"/>
>     <xsd:sequence>
> </xsd:complexType>
> 
> is equivalent to (simplistically):
> 
> class MyClass {
>     MyElement[] arr;
> }
> 
> Hope that makes things clear...
> 
> ThanX,
> 
> Mukund Balasubramanian
> 
> 
> Ayalew Kassahun wrote:
> 
> > hi,
> >
> > How can define C like array (all subelements should be of 
> same type) with
> > XML Schema?
> >
> > thanks in advance,
> > Ayalew
> 
Received on Monday, 5 February 2001 06:06:28 UTC

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