Web Technology - Old Questions
10. Consider a XML file containing element name city <city> </city>. Now write its equivalent XSD to limit the content of city to a set of acceptable values from "PKR", "KTM", "NPJ".
5 marks
|
Asked in 2076
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="city">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="PKR"/>
<xs:enumeration value="KTM"/>
<xs:enumeration value="NPJ"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>