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

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -