Write an XML schema and show the corresponding XML document for credit card.
CODING:
.XML FILE:
<?xml version="1.0" encoding="UTF-8"?>
<card xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="DHTML_XML4_8.xsd">
<cardno>1214 5874 4587 4587</cardno>
<cvv>088</cvv>
<type>Visa</type>
<holder>Anuj Bansal</holder>
</card>
.XSD FILE:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="card" type="CardType"/>
<xsd:complexType name="CardType">
<xsd:sequence>
<xsd:element name="cardno" type="xsd:string"/>
<xsd:element name="cvv" type="xsd:integer"/>
<xsd:element name="type" type="xsd:string"/>
<xsd:element name="holder" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
CODING:
.XML FILE:
<?xml version="1.0" encoding="UTF-8"?>
<card xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="DHTML_XML4_8.xsd">
<cardno>1214 5874 4587 4587</cardno>
<cvv>088</cvv>
<type>Visa</type>
<holder>Anuj Bansal</holder>
</card>
.XSD FILE:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="card" type="CardType"/>
<xsd:complexType name="CardType">
<xsd:sequence>
<xsd:element name="cardno" type="xsd:string"/>
<xsd:element name="cvv" type="xsd:integer"/>
<xsd:element name="type" type="xsd:string"/>
<xsd:element name="holder" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Comments
Post a Comment