This homework is due online Friday, Nov 4, before 10PM.
- You will use Lantern for this exercise. Download a copy of the program.
- Download and store a local copy of the
allelements.xml file.
- The following questions can all be answered using various XPath expressions. Using
Lantern, figure out the correct XPath expression to find the answer to each of the following
questions. The word "element" in these questions
refers to an XML element node, not to a chemical element.
- How many nodes of any type are there in the file?
- How many ATOM elements are there?
- How many ATOM elements have a STATE attribute?
- What is the NAME of the ATOM element whose SYMBOL is "He"?
- What is the BOILING_POINT of the ATOM whose NAME is "Neon"?
- What is the node set containing all the child elements of the ATOM whose SYMBOL is "Es"?
- Of the child elements found with the previous expression, select only the ones that have
at least one attribute of some type.
- What are the UNITS (ie, value of the UNITS attribute) of the HEAT_OF_FUSION of the ATOM whose
ATOMIC_NUMBER is 54?
- Create a simple XML file of your own that could be used to describe your class
schedule this quarter. Name the file class-schedule.xml. The actual structure of the XML
hierarchy is up to you - there are many reasonable ways to structure this data. Among
other things, think about what the root element might be. Should any of the requested
information be stored as attributes, or should child elements be used everywhere? There
is no single best answer, so just take a stab at it and see how it works out. At
minimum, the file should record the following characteristics of your class schedule.
- Your name (given name and surname)
- Your UWNetID
- A list of your classes this quarter, at least two and no more than three.
If you are only taking one class, make up another one. Information about each class
should include the following: Department, Class number, Class name, Schedule line number,
and URL for class web site.
- Given the structure of the file you created in the previous step, create XPath expressions
to extract the following information from your file. (Verify that they work using Lantern.)
- What is your name?
- How many classes are you taking?
- What are the names of the classes you are taking?
- What are the upper division classes you are taking (class number >= 300)?
- Turn in two files online before Friday Nov 4 at 10PM.
- A file containing the list of XPath expressions for the allelements.xml file and
the list of XPath expressions for your class schedule file.
- Your class schedule xml file.