monitor repair

camcorder repair

free repair newsletter

XML File

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 2 U (http://www.xmlspy.com) by skm (skm) -->
<ns1:Suppliers xmlns:ns1="http://www.cybershoppe.com/suppliers" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cybershoppe.com/suppliers
D:\Programming\XML\Problem_Statements\4.P.1\suppliers.xsd">
<Supplier>
<SuppId>S007</SuppId>
<SuppName>
<FirstName>Suresh</FirstName>
<LastName>Meena</LastName>
</SuppName>
<SuppType>Individual</SuppType>
<SuppAddress>
<Street>Tolani</Street>
<City>Mumbai</City>
<State>MH</State>
<Zip>400091</Zip>
</SuppAddress>
<SuppPhone>826299</SuppPhone>
</Supplier>
</ns1:Suppliers>

 

XSD File (suppliers.xsd)

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.cybershoppe.com/suppliers" xmlns:ns1="http://www.cybershoppe.com/suppliers" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="dtp.xsd"/>
<xs:element name="Suppliers" type="ns1:sup"/>
<xs:complexType name="sup">
<xs:sequence>
<xs:element name="Supplier" type="ns1:supp"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="supp">
<xs:sequence>
<xs:element name="SuppId" type="ns1:id"/>
<xs:element name="SuppName" type="ns1:nam"/>
<xs:element name="SuppType" type="ns1:tp"/>
<xs:element name="SuppAddress" type="ns1:address"/>
<xs:element name="SuppPhone" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="tp">
<xs:restriction base="xs:string">
<xs:pattern value="Individual{1}|Company{1}"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="nam">
<xs:choice>
<xs:group ref="ns1:sname"/>
<xs:element name="SuppName" type="xs:string"/>
</xs:choice>
</xs:complexType>
<xs:group name="sname">
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
</xs:sequence>
</xs:group>
</xs:schema>
 

XSD (dtp.xsd)

 

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.cybershoppe.com/suppliers" xmlns:ns1="http://www.cybershoppe.com/suppliers" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="id">
<xs:restriction base="xs:string">
<xs:pattern value="[S]\d{3}"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="address">
<xs:group ref="ns1:add"/>
</xs:complexType>
<xs:group name="add">
<xs:sequence>
<xs:element name="Street" type="xs:string"/>
<xs:element name="City" type="xs:string"/>
<xs:element name="State" type="xs:string"/>
<xs:element name="Zip" type="xs:string"/>
</xs:sequence>
</xs:group>
</xs:schema>