xsd - XML Schema to enforce valid array indexes? -


i have xml file in mock similar array, array name being application, , each element being applicationstring, each containing "index" attribute:

 <con:config>     <con:application con:index="0">         <con:applicationstring>gc1</con:applicationstring>     </con:application>     <con:application con:index="1">         <con:applicationstring>gc2</con:applicationstring>     </con:application>     <con:application con:index="2">         <con:applicationstring>gc3</con:applicationstring>     </con:application>     <con:application con:index="3">         <con:applicationstring>gc5</con:applicationstring>     </con:application> </con:config> 

i wish write xml schema verify "index" attributes indeed valid indexes ranging 0-n , including no duplicates or missing indexes. there known way enforce this? schema have far.

    <xs:element name="config">     <xs:complextype>         <xs:sequence>             <xs:element ref="application" minoccurs="0" maxoccurs="unbounded"/>         </xs:sequence>     </xs:complextype>     </xs:element>     <xs:attribute name="index" type="xs:nonnegativeinteger">     </xs:attribute>     <xs:element name="application">         <xs:complextype>             <xs:sequence>                 <xs:element ref="applicationstring" maxoccurs="1"/>             </xs:sequence>             <xs:attribute ref="index" use="required"/>         </xs:complextype>     </xs:element>     <xs:element name="applicationstring" type="xs:string">     </xs:element> 


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -