XML
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 2 U (http://www.xmlspy.com) by skm (skm) -->
<epp:EMPDETAILS xmlns:epp="http://www.employes.com/detail" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.employes.com/detail
D:\Programming\XML\UGP2\2\employee.xsd">
<EMPLOYEES>
<EMPID>E123</EMPID>
<NAME>suresh</NAME>
<ADDRESS>shere punjab</ADDRESS>
<DESIGNATION>manager</DESIGNATION>
<DEPARTMENT>sales</DEPARTMENT>
<DOJ>2003-12-12</DOJ>
</EMPLOYEES>
</epp:EMPDETAILS>
XSD(employee.xsd)
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.employes.com/detail" xmlns:epp="http://www.employes.com/detail"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="datatype.xsd"/>
<xs:element name="EMPDETAILS" type="epp:EDTL"/>
<xs:complexType name="EDTL">
<xs:sequence>
<xs:element name="EMPLOYEES" type="epp:EMPS"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EMPS">
<xs:sequence>
<xs:element name="EMPID" type="epp:EID"/>
<xs:element name="NAME" type="xs:string"/>
<xs:element name="ADDRESS" type="xs:string"/>
<xs:element name="DESIGNATION" type="xs:string"/>
<xs:element name="DEPARTMENT" type="xs:string"/>
<xs:element name="DOJ" type="epp:DT"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
XSD(datatype.xsd)
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.employes.com/detail" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="EID">
<xs:restriction base="xs:string">
<xs:length value="4"/>
<xs:pattern value="[E]\d{3}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="DT">
<xs:restriction base="xs:string">
<xs:pattern value="\d{4}-\d{2}-\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
|