1411365 DB Design and Implementation Exercise 2: inventory.xml <?xml version=\"1
ID: 3677356 • Letter: 1
Question
1411365 DB Design and Implementation
Exercise 2:
inventory.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="myfile.xsl" ?>
<bookstore specialty="novel">
<book>
<author>
<first-name>Joe</first-name>
<last-name>Bob</last-name>
<award>Trenton Literary Review Honorable Mention</award>
</author>
<price>12</price>
</book>
<book>
<author>
<first-name>Mary</first-name>
<last-name>Bob</last-name>
<publication>Selected Short Stories</publication>
</author>
<editor>
<first-name>Britney</first-name>
<last-name>Bob</last-name>
</editor>
<price>55</price>
</book>
<magazine frequency="monthly">
<price>2.50</price>
<subscription price="24" per="year"/>
</magazine>
<book id="myfave">
<author>
<first-name>Toni</first-name>
<last-name>Bob</last-name>
<degree from="Trenton U">B.A.</degree>
<degree from="Harvard">Ph.D.</degree>
<award>Pulitzer</award>
<publication>Still in Trenton</publication>
<publication>Trenton Forever</publication>
</author>
<price intl="Canada" exchange="0.7">6.50</price>
<excerpt>
<p>It was a dark and stormy night.</p>
<p>But then all nights in Trenton seem dark and
stormy to someone who has gone through what
<emph>I</emph> have.</p>
<definition-list>
<term>Trenton</term>
<definition>misery</definition>
</definition-list>
</excerpt>
</book>
<my:book xmlns:my="uri:mynamespace" price="29.50">
<my:title>Who's Who in Trenton</my:title>
<my:author>Robert Bob</my:author>
</my:book>
</bookstore>
Exercise 2: Write the following XPath queries on the "inventory.xml" to select: a) All editors elements in the document. b) The author(s) of the third book element c) All book elements whose style attribute value is equal to the textbook attribute value of the bookstore element at the root of the document. d) All award elements that belong to book elements e) All title elements one or more levels deep in theExplanation / Answer
Write the following xpath queries for inventory.xml
these queries according to question sequence
a) //editor
b) //book[3]/author
c) //bookstore/book[@style='textbook']
d) //book[.//award]
e) bookstore//title
f) //magazine/price
you also try with this
bookstore/magazine//price
g) //bookstore/book[price>50]/author
you also try withthis
//bookstore/book[price>50]//author
h) //book[@style]
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.