55
C H A P T E R 2 3
X
M
L
E
x
e
r
c
i
s
e
s
23.1 What is meant by recursion in a DTD. Explain with an example.
. .
.3
23.2 Given an XML dataset with DTD as follows
<!DOCTYPE marks [
<!ELEMENT coursemarks(coursename, studentmark*) >
<!ELEMENT studentmark(name, mark)>
]>
with elements coursename, name and mark all being of type
PCDATA.
23.3 XML
a. Give an XML DTD to represent academic information
including
i. Student name and information on courses taken by the student
(in-
cluding course number, year, semester, and grade). Nest course
taken
details inside student elements.
55
56 Chapter 23 XML
Avoid repetition of course information.
. .
.7
b. Give an XQuery query to find all students who have taken two courses
with the same
instructor.
Output student name, course
number,
year, semester
and faculty name. Hint: XQuery uses the syntax
for $x in pathexpression, ...
let..where..result..
. .
.6
23.4 Given a flat XML schema corresponding to the bank application with the ele-
23.5 Give two XML DTDs
corresponding
to the
relational
schemas account(number,
branch, balance),
depositor(number,
name),
customer(name, address).
The first
schema should map relational attributes to XML attributes, and the second one maps
23.6 Give XPath queries on each of the above DTDs to print out all accounts in the Powai branch. (Hint:
XPath queries are like file paths, with selections
within [
])