Session IV Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0 http://www.profburnett.com Outline Introduction XPath Functions XPath 1.0 Nodes Syntax Nodes Relationship / Axes Operators XPath 2.0 8/1/2014 Copyright © Carl M. Burnett 2 Introduction XPath is a syntax for defining parts of an XML document XPath uses path expressions to navigate in XML documents XPath contains a library of standard functions XPath is a major element in XSLT XPath is a W3C recommendation 8/1/2014 Copyright © Carl M. Burnett 3 Introduction XPath Path Expressions Select nodes or node-sets XPath Standard Functions Over 100 built-in functions 8/1/2014 Copyright © Carl M. Burnett 4 Chapter 3 - XPath Nodes Seven Kinds of Nodes: Element Attribute Text Namespace Processing-instruction Comment Document 8/1/2014 Copyright © Carl M. Burnett 5 XPath Node Relationship / Axes Node Relationships / Axes: Parent Children Siblings Ancestors Descendants 8/1/2014 Copyright © Carl M. Burnett 6 XPath Operators XPath Operators 8/1/2014 Copyright © Carl M. Burnett 7 XPath Syntax Path Expression Description nodename Selects all nodes with the name "nodename" / Selects from the root node // Selects nodes in the document from the current node that match the selection no matter where they are . Selects the current node .. Selects the parent of the current node @ Selects attributes Expression Description 8/1/2014 Copyright © Carl M. Burnett 8 Chapter 4 - XPath Functions Accessor Error and Trace Numeric String AnyURI Boolean Duration/Date/Time QName Node Sequence Context 8/1/2014 Copyright © Carl M. Burnett 9 Chapter 15 - XPath 2.0 XQuery/XPath Data Model (XDM) Supports XML Schemas XPath Sequences Comma Separated ordered lists of items. Defined by a node or atomic value. Can have duplicates Flat Structure Can Take Predicates - Filters [ ] Can be used in Loops 8/1/2014 Copyright © Carl M. Burnett 10 XPath 2.0 Processes Average Values Looping Over Sequences Min – Max Using Date and Time Formatting Strings Writing Comments Testing Conditions Processing Non-XML Quantifying a Condition Input Removing Duplicate Items 8/1/2014 Copyright © Carl M. Burnett 11 Review Introduction XPath Functions XPath 1.0 XPath 2.0 Nodes Syntax Nodes Relationship / Axes Next - Chapters 12 & 13 XML Namespaces Operators 8/1/2014 Copyright © Carl M. Burnett 12
© Copyright 2025 Paperzz