You are on page 1of 3

Exercises

Exercise 01:
Assume that data for a book catalogue is available. An XML document for the
book catalogue with the following elements: name, author, pages, price and table of
contents are to be created. The price element should also specify whether the book is
accompanied with a CD or DVD or both.
Create an XML document for the above mentioned catalogue displaying data for
about 10 books.
Exercise 02:
Global Express is USA’s leading integrated air express carrier and premium
logistics-services provider. They have the most extensive domestic network covering
over 20 locations.
Every office of theirs has to maintain a record of the letters despatched on a day-
to-day basis. These records are stored in hard copies which make them prone to
damage or loss of data. To overcome this possibility, the company has decided to store
the information in computers and the data is to be transferred using XML.
Create an XML file called “Order.xml” using the following element names.
Follow the specifications provided in the data given below.
o Invoice
o Order: (Should have an order number attribute)
 Customer Name
 Address
 Order id
 Total Price
o Cod:
 Shipping Address
 Shipping method (air or ground)
 Shipping total
o Account: (State if the account is active or not. The default should
be active.)
 Customer ID
 Invoice period
o Shipping info
 Ship date
 Billing Address (This element should be optional)
o Description
 Description should be one of the product
Keeping into considerations that there are five regional offices and five different
set of data is to be merged at the Head office, duplication of data is a huge possibility. For
example, Customer Name in New York can match a customer name in a Chicago. To
differentiate the data when it is merged, use namespaces to declare elements. Use entity
declarations wherever necessary in the XML document.
Exercise 03:

Consider the following relational database Commodity:

 Products:

pid Name Price Description


323 gizmo 22.99 great
233 gizmo plus 99.99 more features
312 gadget 59.99 good value
Stores:
sid Name Phone
s282 Wiz 555-1234
s521 Econo-Wiz 555-6543
Sells:
pid Markup sid
323 10% s521
233 25% s282
233 15% s521

We want to export this data into an XML file. Write a DTD describing the following
structure for the XML file:
- There is one root element called stores
- The stores element contains a sequence of store sub elements, one for each store
in the database

- Each store element contains one name, and one phone subelement, and a
sequence of product subelements, one for each product that the store sells. Also,
it has an attribute sid of type ID.

- Each product element contains one name, one price, one description, and one
markup element, plus an attribute pid of type ID

You might also like