Assignment 1: XML and Related

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Assignment 1: XML and Related

Consider the following information about Hotels in Paris:


ID Name
Stars Facilities
Address

Les Jardins
du Marais
Golden Tulip
Little Palace

Internet

Tilsitt Etoile

Hotel Saint
Charles

Internet
Gym
Parking
Restaurant
Restaurant 23 rue Brey,
Paris, 75017
Parking
6 rue de
IEsperance,
Paris, 75013

74 rue Amelot,
Paris, 75011
4 rue Salomon
De Caus, Paris,
75003

Distance
from
center
(KM)
2

Available

0.1

False

False

True

True

Exercise 1 HTML and XML (20 points)


Encode the hotel table in
(1) an HTML document
(2) a well-formed XML document

Exercise 2 DTD (20 points)


(1) Create an internal DTD for the XML document above, write the whole XML
document
(2) Create an external DTD for the XML document above, write the whole
XML document by linking the external DTD to the XML document

Exercise 3 XML Schema (20 points)


Create an XML Schema for the above XML document, write the valid instance
xml file according to this XML Schema
For Exercise 2 and 3, please consider the following facts:
Stars is ranging from 1 to 5
Facilities can have at least one or more of the followings: Internet, Gym,
Parking, Restaurant, Pick-up;
Distance can be empty or have one value
Available can be either true or false.

Exercise 4 XPath/XQuery (20 points)


For the above XML document, Please write the following queries in XPath or
XQuery:
(1) Select all the elements in the document
(2) Select all the hotels
(3) Select the facilities of the first before last hotel of the document
(4) Select the ID of the hotel Tilsitt Etoile
(5) Select all the hotels for which the distance from center is given
(6) Select the name, address and stars of the last 3 hotels
(7) Select the name and ID of the hotels with a rating higher or equal than 3
(8) Select the name of the hotels that have in a range of 1.5 KM from the
center
(9) Select all the hotel names

Exercise 5 XSLT (20 points)


Taking the XML document you generated for Exercise 1, provide XSLT style
sheets that:
(1) One XLST style sheet which generates a HTML document listing the
information on a tabular form.
(2) One XLST style sheet which generates a HTML document listing the
same information on a tabular form with entries sorted by name.
(3) One XLST style sheet which generates a HTML document listing the
same information not on a tabular form with the names and IDs displayed
in bold
References:
XQuery: http://tutorial.jcwcn.com/Web-Design/XML/Database-Related/200708-27/3149.html

You might also like