Articles → XSD → Indicators in XSD

Indicators in XSD




























All




<schema
	xmlns="http://www.w3.org/2001/XMLSchema">
	<element name="person">
		<complexType>
			<all>
				<element name="Section" type="string"/>
				<element name="name" type="string"/>
			</all>
		</complexType>
	</element>
</schema>




<person>
	<name>Karan</name>
	<Section>E</Section>
</person>




<person>
	<Section>E</Section>
	<name>Karan</name>
</person>



Choice




<schema
	xmlns="http://www.w3.org/2001/XMLSchema">
	<element name="person">
		<complexType>
			<choice>
				<element name="Section" type="string"/>
				<element name="name" type="string"/>
			</choice>
		</complexType>
	</element>
</schema>




<person>
	<name>Karan</name>
</person>




<person>
	<Section>E</Section>
</person>



Sequence





minOccurs and maxOccurs




<schema
	xmlns="http://www.w3.org/2001/XMLSchema">
	<element name="subject">
		<complexType>
			<sequence>
				<element name="name" type="string"/>
				<element name="books" type="string" minOccurs="1" maxOccurs="3"/>
			</sequence>
		</complexType>
	</element>
</schema>




<subject>
	<name>xml</name>
	<books>Book 1</books>
</subject>




<subject>
	<name>xml</name>
	<books>Book 1</books>
	<books>Book 2</books>
</subject>




<subject>
	<name>xml</name>
	<books>Book 1</books>
	<books>Book 2</books>
	<books>Book 3</books>
</subject>









Element group






<x:group name=“group_name">
</x:group>




<x:schema
	xmlns:x="http://www.w3.org/2001/XMLSchema">
	<x:group name="personInfo">
		<x:sequence>
			<x:element name="name" type="x:string"/>
			<x:element name="age" type="x:int"/>
			<x:element name="Gender" type="x:string"/>
		</x:sequence>
	</x:group>
	<x:element name="person" type="personType"/>
	<x:complexType name="personType">
		<x:sequence>
			<x:group ref="personInfo"/>
			<x:element name="Address" type="x:string"/>
		</x:sequence>
	</x:complexType>
</x:schema>




<person>
	<name>Karan</name>
	<age>33</age>
	<Gender>M</Gender>
	<Address>Gurgaon</Address>
</person>



Attribute group






<x:attributeGroup  name=“attr_group_name">
</x:attributeGroup>




<x:schema
	xmlns:x="http://www.w3.org/2001/XMLSchema">
	<x:attributeGroup name="personAttributes">
		<x:attribute name="name" type="x:string"/>
		<x:attribute name="age" type="x:integer"/>
	</x:attributeGroup>
	<x:element name="person">
		<x:complexType>
			<x:attributeGroup ref="personAttributes"/>
		</x:complexType>
	</x:element>
</x:schema>




<person name="Karan" age="33">
</person>



Posted By  -  Karan Gupta
 
Posted On  -  Friday, January 9, 2015

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250