Question: Now consider the following XML document and answer the questions below. 1 2 3 4 5 6 7 8 9 10 Gershwin: Rhapsody In Blue

Now consider the following XML document and answer the questions below.

1

2

3

4

5

6

7

8

9

10

Gershwin: Rhapsody In Blue / An American In Paris

George Gershwin

Leonard Bernstein

Rhapsody in Blue

An American in Paris

Now consider the following XML document and answer the questions below. 1

Recall that in an XMLTree the children of a given node are numbered with increasing integer values (indices, positions) starting at 0 for the first child, 1 for the second child, etc. For instance, in the XMLTree above,

is child 0 of <album>, <composer> is child 1, <conductor> is child 2, and so on. <p>What is child 3 of <album>?</album></p> <p>What is child 0 of <tracks>?</tracks></p> <p>What is child 1 of <composer>?</composer></p> <p>A path in an XMLTree can be identified in two different ways by either listing the labels of the nodes on the path or by listing the index of each node (except the root) as a child of its parent. So, for instance, a path from the root to the George Gershwin node can be identified either by listing the nodes on the path: (<album>, <composer>, George Gershwin), or by listing the root followed by the indices corresponding to the nodes on the path: (<album>, 1, 0) because <composer> is child 1 of <album> and George Gershwin is child 0 of <composer>.</composer></album></composer></album></composer></album></p> <p>Consider the text node An American in Paris in the XML tree above.</p> <p>Draw the nodes on a path from the root of the tree to this node.</p> <p>For each of the nodes on this path (except for the root), what is the integer index of the node as a child of its parent?</p> <p>Adding Attributes</p> <p>Suppose we modified the XML document above so that both the <composer> and the <conductor> tags have an attribute born whose value is the date of birth, i.e.,</conductor></composer></p> <table border="0" cellspacing="0"> <tbody> <tr> <td> <p>3</p> <p>4</p> </td> <td> <p><composer born="Sep 26, 1898">George Gershwin</composer></p> <p><conductor born="Aug 25, 1918">Leonard Bernstein</conductor></p> </td> </tr> </tbody> </table> <p>Draw the nodes in the XMLTree that would have to be modified to include this new information.</p> <p>Replacing Attribute with Child</p> <p>Now suppose we wanted to change the <released> tag in the XML document above so that the date is not an <em>attribute</em> of the tag but instead a <em>text child</em> of the tag node.</released></p> <p>Rewrite line 5 in the XML document above to show the result of this change.</p> <p>Draw the nodes in the XMLTree that would have to be modified to reflect this change in the XML document.</p> <p>Drawing an XMLTree</p> <p>Consider the following XML document:</p> <table border="0" cellspacing="0"> <tbody> <tr> <td> <p>1</p> <p>2</p> <p>3</p> <p>4</p> <p>5</p> <p>6</p> <p>7</p> <p>8</p> </td> <td> <p><weather></weather></p> <p> <location></location></p> <p> <city>Columbus</city></p> <p> <state>OH</state></p> <p> </p> <p> <current text="Light Rain" high="75" low="54" date="8 Sep 2012"></current></p> <p> <forecast text="Sunny" high="79" low="52" date="9 Sep 2012"></forecast></p> <p></p> </td> </tr> </tbody> </table> <p>Draw the complete XMLTree corresponding to this document.</p> <p>A city is logically inside a state. So, change the structure of the XML document to put the <city> element inside the <state> element. What essentially arbitrary decision did you make when doing this? Redraw the part of the XMLTree that is changed by this modification, taking care to match the document with respect to the decision just mentioned.</state></city></p> Here is a picture of an XMLTree representing the second XML document above. 15. Draw the node(s) in the tree that correspond to line 3 in the XML document. 16. Draw the node(s) in the tree that correspond to line 8 in the XML document. 17. What line(s) in the XML document correspond to the > node? 18. What line(s) in the XML document correspond to the tracks node? 19. What's the only tag node that is a leaf in the XMLTree</conductor></composer></album>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!