An item is either
These are items
10
"ten"
10.0
<Number base = "8">
<Digit>1</Digit>
<Digit>2</Digit>
</Number>
val="10"
The syntax for making a document node is
doc(filename)
e.g.
doc("movies.xml")
doc("/Users/sam/data/movies.xml")
doc("infolab.stanford.du/~hector/movies.xml")
A path expression of the form /T1/T2/.../Tn
means
T1
, then T2
, …, until Tn
Example: Show how this works on /StarMovieData/Star/Name
Syntax
/T1/T2/.../Tn/@A
Show the result of
/StarMovieData/Star/@starID
Navigation through an XPath expression is along axes. Each axis has a full name and a short name. E.g. the path
/StarMovieData/Star/@starID
is actually short for
/child::StarMovieData/child::Star/attribute::starID
These are the 13 possible total axes (with shorthand if any):
Example: Show what //City returns.
Show the result of
/StarMovieData/*/@*
Operators that can be used in XPath expressions:
|
+
-
*
div
=
!=
<
<=
>
>=
or
and
mod
Explain what these expressions return.
/StarMovieData/Star[//City="Malibu"]/Name
/Movies/Movie/Version[1]/@year
/Movies/Movie/Version[Star]