{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec16.366 - Winter 2008 CPE/CSC 366 Database Modeling...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
. . Winter 2008 CPE/CSC 366: Database Modeling, Design and Implementation Alexander Dekhtyar . . XPath Introduction XPath is a language for addressing parts of XML documents. It has been designed within the World Wide Web Consortium (W3C) and has a status of a W3C Recommendation (Version 1.0, a de-facto standard). Complete XPath Recommendation can be found here: http://www.w3.org/TR/xpath XPath Essentials XPath is designed to address well-formed parts of XML documents. It is de- signed to be used in URIs (Universal Resource Identifiers), and therefore, it has a non-XML syntax. XPath gives two ways of expressing paths: full syntax and abbreviated syntax . In full syntax , an XPath expression consists of a sequence of location steps separated by a ”/” (slash). The basic anatomy of an XPath expression, and of a location step is shown below: XPath ::= [/] LocationStep [/ LocationStep]* LocationStep ::= AxisName ’::’ [NodeTest] ’[’ [Predicate]’]’ Here: AxisName: is the name of the type of a “one-step” traversal through the XML (DOM) tree. NodeTest: describes the names of the XML elements of interest on current step. Predicate: specifies additional selection conditions on the nodes for the next step. 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Axes XPath expressions describe the traversal of the XML tree. An XPath axis is one step in the traversal. A context node is a node in the XML (DOM) tree that is current on the path. Axis Meaning 1 ancestor proceed to the ancestors of context node(s) 2 ancestor-or-self ancestor or self 3 attribute proceed to the attributes of context node(s) 4 child proceed to children of context node(s) 5 descendant proceed to descendants of context node in the DOM tree 6
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}