One element multiple times



I want to be able to specify one element, in my case Param, multiple times. This is the XSD:



<xs:schema xmlns:xs="http://ift.tt/tphNwY">
<xs:element name="Abc">
<xs:complexType>
<xs:sequence>
<xs:element name="Def" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:all>
<!-- ... other elements ... -->
<xs:element name="Param" minOccurs="0" maxOccurs="unbounded"> <!-- Using unbounded is not allowed here -->
<xs:complexType>
<xs:attribute name="Name"/>
<xs:attribute name="Value"/>
</xs:complexType>
</xs:element>
<!-- ... other elements ... -->
</xs:all>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


This is the corresponding XML:



<Abc xsi:noNamespaceSchemaLocation="SourcesSchema.xsd" xmlns:xsi="http://ift.tt/ra1lAU">
<Def>
<Param Name="one" Value="blue"/>
<Param Name="two" Value="yellow"/>
<Param Name="three" Value="green"/>
</Def >
</Abc>


Trying this, I get the following exception:



Cos-all-limited.2: The {max Occurs} Of An Element In An 'all' Model Group Must Be 0 Or 1. The Value '-1' For Element 'Param' Is Invalid.

No comments:

Post a Comment