RE: C type array and struct

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