Group Members
1- Siti Sakirah Binti Mat (ai140068)
2- Siti Hajjar Binti Tuan Mat (ai140148)
3- Noor Salwaniza Binti Zainol Abidin (ai140087)
Question 1
Adharizq Enterprise has a phone directory that records the first and last name, phone number and email address of every staff in the company. Departments are the main organising unit of the company so the phone directory is typically displayed in department order and shows for each department the phone no, fax number and email address.
<company>
<department>
<staff>
<firstname>siti</firstname>
<lastname>hajjar</lastname>
<phone>0145555555</phone>
<email>siti@gmail.com</email>
<fax>0999999</fax>
</staff>
</department>
</company>
Question 2
a. Give an XML-document (by not using attributes), which includes the information that the first name of a person is Zahra, her last name is Adib, and her professions are doctor, therapist and surgeon.
<biodata>
<name>
<firstname> Zahra</firstname>
<lastname> Adib</lastname>
</name>
<professions>
<job1>doctor</job1>
<job2>therapist</job2>
<job3>surgeon</job3>
</professions>
</biodata>
b. Give the tree diagram of the document given in 2a.
c. Modify the document given in exercise 2a such that the “first” and “last” are the attributes of the name element.
<biodata>
<person name="fullname">
<firstname> Zahra</firstname>
<lastname> Adib</lastname>
</person>
<professions>
<job1>doctor</job1>
<job2>therapist</job2>
<job3>surgeon</job3>
</professions>
</biodata>
Question 3
a. Give an XML-document (by not using attributes), which includes the following information: the social security number (123456789A), the first name of a person is Adha, and his last name is Hadif, his address is composed of postcode (86400), city (Batu Pahat) and street (Jalan Puding), and his telephone numbers are 12345 and 67890.
<?xml version="1.0"?>
<profile>
<security_no>123456789A</security_no>
<firstname>Adha</firstname>
<lastname>Adib</lastname>
<address>
<postcode>86400</postcode>
<city>Batu Pahat</city>
] <street>Jalan Puding</street>
</address>
<phone_no>
<no_1>12345</no_1>
<no_2>67890</no_2>
</phone_no>
</profile>
b. Give the tree diagram of the document given in exercise 3a.
c. Give a DTD (Document Type Definition) for the XML-document specified in 3a.
<?!DOCTYPE profile
[
<!ELEMENT address (postcode,city,street)
<!ELEMENT postcode (#PCDATA)
<!ELEMENT city (#PCDATA)
<!ELEMENT street (#PCDATA)
]>
d. Give an XML Schema for the information specified in exercise 3a.
<xs:element name="profile">
<xs:complexType>
<xs:sequence>
<xs:element name="security_no" type="xs:varchar"/>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:complexType>
<xs:sequence>
<xs:element name="security_no" type="xs:varchar"/>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element name="postcode" type="xs:int"/>
<xs:element name="city" type="xs:varchar"/>
<xs:element name="street" type="xs:varchar"/>
<xs:sequence>
<xs:element name="postcode" type="xs:int"/>
<xs:element name="city" type="xs:varchar"/>
<xs:element name="street" type="xs:varchar"/>
</xs:sequence>
</xs:complexType>
</xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element name="no_1" type="xs:int"/>
<xs:element name="no_2" type="xs:int"/>
<xs:sequence>
<xs:element name="no_1" type="xs:int"/>
<xs:element name="no_2" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:complexType>
</xs:element>
No comments:
Post a Comment