NewtFire logo: a mosaic rendering of a firebelly newt
newtFire {upg dh|ds}
Creative Commons License Last modified: Sunday, 16-Feb-2020 21:48:01 UTC. Maintained by: Elisa E. Beshero-Bondar (eeb4 at psu.edu). Powered by firebellies.

Again for this exercise, we'll be working with our XML of Georg Forster's voyage narrative. Download the XML file I have linked here: ForsterGeorgComplete.xml. Open the file in oXygen and work with the XPath 3.1 window. Respond to the XPath questions below in a text file, and upload to Canvas for this assignment when you're finished. (Please use an attachment! If you paste your answer into the text box, Canvas may munch your code syntax.) Some of these tasks are thought-provoking, and even difficult. If you get stuck, do the best you can, and if you can’t get a working answer, give the answers you tried and explain where they failed to get the results you wanted. Sometimes doing that will help you figure out what’s wrong, and even when it doesn’t, it will help us identify the difficult moments.

These tasks require the use of path expressions, predicates, and the functions. There may be more than one possible answer. You may find class notes and our introductory guide Follow the XPath! a helpful resource as you proceed. With the Georg Forster file open in oXygen and using the XPath 3.1 browser window in oXygen, construct XPath expressions that will do the following. Be sure to give the FULL XPath expression you used in your answer, and don't just report your results. This way, if the answer is incorrect, we can help explain what went wrong.

Georg Forster often took note of when latitude and longitude coordinates were measured during his trip with Captain Cook. We've spent some time capturing and coding these (with help from regular expressions!), and now we can use XPath to work with our geographic coordinates. We've used <geo select="lat"> for latitude readings, and <geo select="lon"> for longitude readings.

  1. Write an XPath expression to locate all the geo elements in Book I that contain latitude measurements. How many are there (only in Book I)? Check the number in the oXygen result window (Description line). Then rewrite the expression to use the count() function and return just the result window. Be careful when you use the count() function here that you're getting only the count in Book I.
  2. These latitude measurements you've just looked up are all held inside paragraphs, or the <geo select="lat"> element. What would you add to the previous XPath expression to return the paragraphs that hold latitude measurements in Book I? Give your complete XPath expression here.
  3. Write an XPath expression to find the first paragraph in Book III, Chapter 1 that contains a latitude reading. What's the number of this paragraph as coded in the file?
  4. Write an XPath to bring up all the paragraphs in this WHOLE file that contain both latitude AND longitude readings. How many of these paragraphs are there?
  5. Are there any paragraphs in this WHOLE file that do NOT have a latitude measurement, but DO have a longitude? (Hint: You will need to use a not() function to ensure you are finding only paragraphs that do NOT have latitudes marked.) What XPath expression reveals these? And how many of these paragraphs are there?

  6. Explain why the following two XPath expressions return different results. Run each XPath expression, review the results, and explain what you think each expression is returning.