XYZ school wants to store the details of student and staff in a xml file. The following scenario helps in designing the XML document.
persons will be the root tag. persons will have the entry of each person with name, age, gender, address. A person can be either a student or staff. student will have rollno, standard and section. If staff, then staffid and subject. Every person must have an address with the following entry- doorno,street,city and state.
Answers
Answer:
Explanation:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http">
<xs:element name="persons">
<xs:complexType>
<xs:sequence>
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="age" type="xs:integer" />
<xs:element name="gender" type="xs:string" />
<xs:element name="address">
<xs:sequence>
<xs:element name="doorno" type="xs:integer" />
<xs:element name="street" type="xs:string" />
<xs:element name="city" type="xs:string" />
<xs:element name="state" type="xs:string" />
</xs:sequence>
</xs:element>
<xs:element name="student" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="rollno" type="xs:integer" />
<xs:element name="standard" type="xs:integer" />
<xs:element name="section" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="staff" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="staffid" type="xs:integer" />
<xs:element name="subject" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>