Re: C type array and struct

Ayalew,

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

In order to have the<xsd:element> tag you must provide a name or a ref [1].
The only other way I could suggest otherwise, is to utilize an "<any>"
element instead of an "<element>" element.  Then you could still constrain
the occurences without a specific name.

>  The number of elements is given by the 'length' attribute.

I don't think this is possible in this version of XML Schemas (though I may
stand correction).  I think that you would have to apply this later in the
application.  In general this is a rule based approach-- in XML Schemas you
cannot constrain an element's declaration through an instance attribute
(except maybe xsi:type).

[1] http://www.w3.org/TR/xmlschema-1/#declare-element (section 1.3)

Good Luck,
Jeff Rafter
Defined Systems
http://www.defined.net

Received on Monday, 5 February 2001 13:24:34 UTC