session ii chapter 3 – chapter 3 – xpath patterns & expressions chapter 4 – xpath...

12
CMP 051 XML Introduction Session II Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0 http://www.profburnett.com

Upload: maximillian-barnett

Post on 18-Jan-2016

230 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0

CMP 051XML Introduction

Session II Chapter 3 – XPath Patterns & Expressions

Chapter 4 – XPath FunctionsChapter 15 – XPath 2.0

http://www.profburnett.com

Page 2: Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0

Copyright © Carl M. Burnett 2

OutlineIntroductionXPath 1.0

NodesSyntaxNodes Relationship /

AxesOperators

XPath FunctionsXPath 2.0

8/1/2014

Page 3: Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0

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

Page 4: Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0

Copyright © Carl M. Burnett 4

IntroductionXPath Path Expressions

Select nodes or node-sets XPath Standard Functions

Over 100 built-in functions

8/1/2014

Page 5: Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0

Copyright © Carl M. Burnett 5

Chapter 3 - XPath NodesSeven Kinds of Nodes:

ElementAttributeTextNamespaceProcessing-instructionCommentDocument

8/1/2014

Page 6: Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0

Copyright © Carl M. Burnett 6

XPath Node Relationship / AxesNode Relationships / Axes:

ParentChildrenSiblingsAncestorsDescendants

8/1/2014

Page 7: Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0

Copyright © Carl M. Burnett 7

XPath OperatorsXPath Operators

8/1/2014

Page 8: Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0

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

Page 10: Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0

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

Page 11: Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0

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

Page 12: Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0

Copyright © Carl M. Burnett 12

ReviewIntroductionXPath 1.0

NodesSyntaxNodes Relationship /

AxesOperators

XPath FunctionsXPath 2.0

8/1/2014

Next - Chapters 12 & 13 XML Namespaces