WTA6 XPath - 3/31/2011 (XPath) XPath allows us to select...

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

View Full Document Right Arrow Icon
3/31/2011 1 1 (XPath) XPath allows us to select only the nodes we're interested in 2 Introduction b XPath (search enabling language) is used to navigate through elements and attributes within an XML document. b Using XPath, you can select one or more nodes in order to retrieve the data they contain. b XSLT (to transform the contents of your XML documents) and other XML based languages such as XQuery and XPointer also rely on XPath expressions.
Background image of page 1

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

View Full DocumentRight Arrow Icon
3/31/2011 2 XML Document Navigation b To navigate XML document means to traversal the elements and attributes. b There are two techniques s DOM structure- to harvest the desired subset of DOM nodes, but this is not generalized technique s simple text based addressing language (XPath, Xpointer, XLink) 3 What is XPath? b XPath is a syntax for defining parts of an XML document b XPath uses path expressions to navigate in XML documents b XPath contains a library of standard functions b XPath is a major element in XSLT b XPath is a W3C recommendation 4
Background image of page 2
3/31/2011 3 Xpath uses the following b XPath Path Expressions s XPath uses path expressions to select nodes or node- sets in an XML document. These path expressions look very much like the expressions seen while working with a traditional computer file system. b XPath Standard Functions s XPath includes over 100 built-in functions. There are functions for string values, numeric values, date and time comparison, node and QName manipulation, sequence manipulation, Boolean values, and more. 5 Node b Xpath views an XML document as if it is a tree. This tree structure consists of nodes. One node can contain other child nodes. Nodes represent the elements of an XML document. b Xpath specification defines seven node types: s Root s Element s Attribute s Text s Comment s Processing instruction s namespace 6
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 XML Tree <?xml version=“1.0”?> <!-- This is a comment --> <BOOK author=“Andrew Tannenbaum” edition=“3”> <REVIEW> This is a wonderful book!</REVIEW> Computer Networks </BOOK> 7 Root Element BOOK Attribute author=“Andrew Tannenbaum” Attribute edition=“3” Element REVIEW Text This is a wonderful book! Text Computer Networks Comment This is a comment Location Paths b A location path is an expression that specifies how to navigate in an Xpath tree from one node to another. b
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/04/2011 for the course IT 103 taught by Professor Php during the Spring '11 term at University of Mumbai.

Page1 / 17

WTA6 XPath - 3/31/2011 (XPath) XPath allows us to select...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online