Question: With the XML file of Exercise R25.10 , give XPath expressions that yield a. the value of the first coin. b. the number of

With the XML file of Exercise •• R25.10 , give XPath expressions that yield

a. the value of the first coin.

b. the number of coins.

c. the name of the first child element of the first coin element.

d. the name of the first attribute of the first coin’s name element. (The expression @* selects the attributes of an element.)

e. the value of the lang attribute of the second coin’s name element.

Data from exercise R25.10

 Consider the XML file:

0.5 half dollar 0.25 quarter

What are the values of the following XPath expressions?

a. /purse/coin[1]/value

b. /purse/coin[2]ame

c. /purse/coin[2]ame/@lang

d. name(/purse/coin[2]/*[1])

e. count(/purse/coin)

f. count(/purse/coin[2]ame)

0.5 half dollar 0.25 quarter

Step by Step Solution

3.41 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Based on the XML structure provided here are the XPath expressions that would yield the following results a The value of the first coin XPath expressi... View full answer

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 Java Programming Questions!