XML Technologies and Applications. Rajshekhar Sunderraman Department of Computer Science Georgia State University Atlanta, GA 30302 email@example.com V (a). XML Querying: XPath December 2005. Outline. Introduction XML Basics XML Structural Constraint Specification
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Rajshekhar SunderramanDepartment of Computer Science
Georgia State University
Atlanta, GA firstname.lastname@example.org
V (a). XML Querying: XPath
Root of XML tree
Root of XML document
<?xml version=“1.0” ?>
<!-- Some comment -->
<Student StudId=“111111111” >
<CrsTaken CrsCode=“CS308” Semester=“F1997” />
<CrsTaken CrsCode=“MAT123” Semester=“F1997” />
<Student StudId=“987654321” >
<CrsTaken CrsCode=“CS308” Semester=“F1994” />
<!-- Some other comment -->
Denotes an attribute
a-children of Student, which are e-children of Students, which are children of the root
This is called full syntax.
We used abbreviated syntax before.
Full syntax is better for describing meaning. Abbreviated syntax is better for programming.
Students/Student[CourseTaken/@CrsCode = “CS532”]
The meaning of the expression locationStep1/locationStep2/… is the
set of all document nodes obtained as follows:
True if : “CS532” //Student/CrsTaken/@CrsCode
//Student[Status=“U3” andstarts-with(.//Last, “A”)
andnot(.//Last = .//First) ]
//Student[sum(.//@Grade) div count(.//@Grade) > 3.5]
or Status/text() = “U4”] – students who have either a first name or have taken a course in some semester or have status U4
url#xpointer (XPathExpr1) xpointer (XPathExpr2) …
and CrsTaken/@Semester=“S2002” ] )