Mega Code Archive

 
Categories / XML Tutorial / XML Schema
 

Requiring Elements to Appear in Sequence

A sequence determines the order in which its contained elements may appear in an XML document. A sequence can also contain other sequences, choices or references to named groups. A sequence may be contained in a complex type definition in other sequences, or in a set of choices or in named group definitions. It's legitimate for a sequence to contain only one element.   <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"   targetNamespace="http://www.rntsoft.com" xmlns="http://www.rntsoft.com"   elementFormDefault="qualified">   <xsd:complexType name="animalType">     <xsd:sequence>       <xsd:element name="name" type="xsd:string" minOccurs="2" />       <xsd:element name="subspecies" type="xsd:string" />     </xsd:sequence>   </xsd:complexType> </xsd:schema>