Uploaded by Learn With Asad

bc160200506 CS311

advertisement
CS311 Assignment No.1
Student ID: bc160200506
Question:
Suppose a customer place an order to purchase five different items including gloves, hand
sanitizer, test kit, medicine, and face mask form an online medical store. The XML tree of the
following scenario is given below:
Now you are required to create an internal DTD and XML document form the given XML Tree.
1. DTD Code (10 marks)
2. XML Code (10 marks)
Answer
<?xml version="1.0"?>
<!--Introduction to Web services Development - CS311 -->
<!--Assignment No. 01 Fall 2020 -->
<!--DTD-->
<!DOCTYPE Online_Medical_Store
[
<!ELEMENT Online_Medical_Store (Customer)>
<!ELEMENT Customer (Order)>
<!ATTLIST Customer
Name CDATA #REQUIRED
Address CDATA #REQUIRED>
<!ELEMENT Order (Gloves,Hand_Sanitizer,Test_Kit,Medicine,Face_Mask)>
<!ELEMENT Gloves (#PCDATA)>
<!ELEMENT Hand_Sanitizer (#PCDATA)>
<!ELEMENT Test_Kit (#PCDATA)>
<!ELEMENT Medicine (#PCDATA)>
<!ELEMENT Face_Mask (#PCDATA)>
<!ATTLIST Face_Mask
Name CDATA #REQUIRED
Company CDATA #REQUIRED>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Address (#PCDATA)>
]>
<!-- XML Document -->
<!-- Root Element – Online Medical Store-->
<Online_Medical_Store>
<Customer Name="Ali" Address= "Mall Road LHR">
<Order Id="001" Date="01-12-2020">
<Gloves >08</Gloves >
<Hand_Sanitizer >04</Hand_Sanitizer >
<Test_Kit>05</Test_Kit>
<Medicine>03</Medicine>
<Face_Mask Name="Blue" Company="ABC">
</Face_Mask>
</Order>
</Customer>
</Online_Medical_Store>
Download