Mega Code Archive

 
Categories / XML Tutorial / XML Schema
 

Requiring Repeating Sequences of Elements

<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"   targetNamespace="http://www.rntsoft.com" xmlns="http://www.rntsoft.com"   elementFormDefault="qualified">     <xs:element name = "data" >        <xs:complexType>           <xs:sequence minOccurs = "3" maxOccurs = "3">                 <xs:element name = "One" type = "xs:string" />                 <xs:element name = "Two" type = "xs:string" />                 <xs:element name = "Three" type = "xs:string" />           </xs:sequence>        </xs:complexType>     </xs:element> </xs:schema> So, the following is the only allowable conforming instance document: <data>    <One>First came</One>    <Two>Second came</Two>    <Three>Third came</Three>    <One>First came</One>    <Two>Second came</Two>    <Three>Third came</Three>    <One>First came</One>    <Two>Second came</Two>    <Three>Third came</Three> </data>