XSD (XML Schema Definition) Overview
XSD (XML Schema Definition) Overview
XSD is the main documents to be defined before you are starting any BPEL, ESB or
Webservice.
Here I would like to cover brief overview on XML Schema Definition (XSD):
XSD defines a template for what XML document contains.
For example if you want to put restriction on class element which accepts data between
1 to 12, define like following:
<xs:simpletype name=classtype>
<xs:restriction base=xs:integer>
<xs:minInclusive value=1/>
<xs:maxInclusive value=12/>
</xs:restriction>
</xs:simpletype>
If you want limit the content of xml element to set of acceptable values use
<xs:enumaration> tag.
More on XSD Restrictions/Facets can be found on following link :
http://www.w3schools.com/schema/schema_facets.asp
Finally example xml schema definition file:
<! Declaration>
<?xml version=1.0 encoding=UTF-8?>
<! Definations>
<xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema”
targetNameSpace=http://www.rayalasoft.com/employee.xsd”
xmlns:tns=http://www.rayalasoft.com/employee.xsd>
<! Imports if you have any imports
<xs:include schemaLocation=anotherschemaname.xsd>
>
<! Elements declaration >
<xs:element type=tns:employeeStruct/>
<! Types declaration >
<xs:complexType name=employeeStruct>
<xs:sequence>
<xs:element name=employeeID type=integer/>