Write a program which describes XML document and corresponding Schema (for Complex type).
CODIND:
.XML FILE:
<?xml version="1.0" encoding="UTF-8"?>
<student xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="DHTML_XML4_6.xsd">
<roll>101</roll>
<name>ABC</name>
<marks>98</marks>
<result>Distinction</result>
</student>
.XSD FILE:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="student" type="StudentType"/>
<xsd:complexType name="StudentType">
<xsd:sequence>
<xsd:element name="roll" type="xsd:integer"/>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="marks" type="xsd:integer"/>
<xsd:element name="result" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
CODIND:
.XML FILE:
<?xml version="1.0" encoding="UTF-8"?>
<student xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="DHTML_XML4_6.xsd">
<roll>101</roll>
<name>ABC</name>
<marks>98</marks>
<result>Distinction</result>
</student>
.XSD FILE:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="student" type="StudentType"/>
<xsd:complexType name="StudentType">
<xsd:sequence>
<xsd:element name="roll" type="xsd:integer"/>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="marks" type="xsd:integer"/>
<xsd:element name="result" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Comments
Post a Comment