session ii chapter 3 – chapter 3 – xpath patterns & expressions chapter 4 – xpath...
TRANSCRIPT
CMP 051XML Introduction
Session II Chapter 3 – XPath Patterns & Expressions
Chapter 4 – XPath FunctionsChapter 15 – XPath 2.0
http://www.profburnett.com
Copyright © Carl M. Burnett 2
OutlineIntroductionXPath 1.0
NodesSyntaxNodes Relationship /
AxesOperators
XPath FunctionsXPath 2.0
8/1/2014
Copyright © Carl M. Burnett 3
IntroductionXPath is a syntax for defining parts of an XML documentXPath uses path expressions to navigate in XML
documentsXPath contains a library of standard functionsXPath is a major element in XSLTXPath is a W3C recommendation
8/1/2014
Copyright © Carl M. Burnett 4
IntroductionXPath Path Expressions
Select nodes or node-sets XPath Standard Functions
Over 100 built-in functions
8/1/2014
Copyright © Carl M. Burnett 5
Chapter 3 - XPath NodesSeven Kinds of Nodes:
ElementAttributeTextNamespaceProcessing-instructionCommentDocument
8/1/2014
Copyright © Carl M. Burnett 6
XPath Node Relationship / AxesNode Relationships / Axes:
ParentChildrenSiblingsAncestorsDescendants
8/1/2014
Copyright © Carl M. Burnett 7
XPath OperatorsXPath Operators
8/1/2014
Copyright © Carl M. Burnett 8
XPath SyntaxPath 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 9
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 10
Chapter 15 - XPath 2.0XQuery/XPath Data Model (XDM)Supports XML SchemasXPath 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 11
XPath 2.0 ProcessesAverage ValuesMin – MaxFormatting StringsTesting ConditionsQuantifying a ConditionRemoving Duplicate
Items
Looping Over SequencesUsing Date and TimeWriting CommentsProcessing Non-XML
Input
8/1/2014
Copyright © Carl M. Burnett 12
ReviewIntroductionXPath 1.0
NodesSyntaxNodes Relationship /
AxesOperators
XPath FunctionsXPath 2.0
8/1/2014
Next - Chapters 12 & 13 XML Namespaces