XSD to validate element containing sequence and attibutes



Why my XSD is not working for following XML structure? It says 'Invalid content was found starting with element 'Rights'. No child element is expected at this point.'


XML:



<Rights Status="xxx" Date="2009-02-03T00:00:00">
<Right>
<Amount>9999</Amount>
<AmountCovered>888</AmountCovered>
</Right>
<Right>
<Amount>8888</Amount>
<AmountCovered>777</AmountCovered>
</Right>
...
</Rights>


XSD:



<xs:element name="Rights" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Right" maxOccurs="unbounded">
<xs:complexType>
<xs:all>
<xs:element name="Amount" type="xs:string" minOccurs="0" />
<xs:element name="AmountCovered" type="xs:string" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Status" use="optional" type="xs:string" />
<xs:attribute name="Date" use="optional" type="xs:dateTime" />
</xs:complexType>
</xs:element>

No comments:

Post a Comment