SlideShare ist ein Scribd-Unternehmen logo
1 von 66
Downloaden Sie, um offline zu lesen
Introduction to XPath
Kristian Torp
Department of Computer Science
Aalborg University
people.cs.aau.dk/˜torp
torp@cs.aau.dk
November 3, 2015
daisy.aau.dk
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 1 / 59
Outline
1 Introduction
2 Tree Terminology
3 Location Path and Steps
4 XPath Path Expressions
5 Axes
6 Summary
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 2 / 59
Learning Goals and Focus
Learning Goals
Understand the XPath data model
Know the basic tree terminology
Good at querying XML documents using XPath
Know the abbreviations used in XPath
Very handy to know in practice
Compact and quite readable!
Database Focus
All XML technologies are presented from a database perspective also
called a data focus (i.e., not a document focus)!
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 3 / 59
Outline
1 Introduction
2 Tree Terminology
3 Location Path and Steps
4 XPath Path Expressions
5 Axes
6 Summary
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 4 / 59
Introduction
Example
Find all courses: /coursecatalog/course
Find the semesters: //semester/text()
Overview
A language for
finding/addressing information in XML documents
navigating through elements and attributes in an XML document
Used in many XML technologies, e.g., XQuery and XPointer
A part of the XSLT recommendation
Microsoft/Visual Studio makes heavy usage of XSLT
The data model is an abstract and logical structure of an XML
document
Called a node tree
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 5 / 59
The Node Tree
Terminology
Document node: The entire XML document
Also called the document root or the root node
Element node: An XML element
A special one is the document element or root element
Text node: The text strings in an element node
Attribute node: An attribute
Example (A Node Tree)
/
coursecatalog
course
id=4 name
OOP
semester
3
desc
snip
course
id=2 name
DB
semester
7
desc
snip
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 6 / 59
Example: Find the Courses
Example (Document)
/
coursecatalog
course
id=4 name
OOP
semester
3
desc
snip
course
id=2 name
DB
semester
7
desc
snip
Query
/coursecatalog/course
Result
course
id=4 name
OOP
semester
3
desc
snip
course
id=2 name
DB
semester
7
desc
snip
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 7 / 59
Example: Find the Semesters
Example (Document)
/
coursecatalog
course
id=4 name
OOP
semester
3
desc
snip
course
id=2 name
DB
semester
7
desc
snip
Query
//semester/text()
Result
3 7
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 8 / 59
Major Components
Components
Nodes
XML document treated as a tree of nodes
Examples: Elements, attributes, and comments
Path expressions
Select a set of nodes in an XML document
Examples: /, /coursecatalog/course
Standard functions
Approximate 100 built-in functions
Examples: concat(’a’, ’b’), round(1.5)
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 9 / 59
Quiz
Example (Document)
/
coursecatalog
course
id=4 name
OOP
semester
3
desc
snip
course
id=2 name
DB
semester
7
desc
snip
Questions
Who is the parent of the document element?
How many document elements are there in an XML document?
How many elements can there be in an XML document?
Are elements and attributes the same node type?
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 10 / 59
Outline
1 Introduction
2 Tree Terminology
3 Location Path and Steps
4 XPath Path Expressions
5 Axes
6 Summary
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 11 / 59
Tree Terminology
Example (A Node Tree)
1
2
3 4
5
6
7
8
9 A B
Tree
Like any other tree in CS
Tree Terminology
Example (A Node Tree)
1
2
3 4
5
6
7
8
9 A B
Root
Quiz
Are there other roots?
Tree Terminology
Example (A Node Tree)
1
2
3 4
5
6
7
8
9 A B
Leafs
Quiz
Are there more leafs?
Tree Terminology
Example (A Node Tree)
1
2
3 4
5
6
7
8
9 A B
Children of 1
Quiz
Who are the children of 3?
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 12 / 59
Tree Terminology
Example (A Node Tree)
1
2
3 4
5
6
7
8
9 A B
Siblings of 9
Quiz
Who are the siblings of 3?
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 12 / 59
Tree Terminology
Example (A Node Tree)
1
2
3 4
5
6
7
8
9 A B
Ancestors of 6
Quiz
Who are the ancestors of 9?
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 12 / 59
Tree Terminology
Example (A Node Tree)
1
2
3 4
5
6
7
8
9 A B
Parent of 8
Quiz
Who are the parents of 4?
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 12 / 59
Tree Terminology
Example (A Node Tree)
1
2
3 4
5
6
7
8
9 A B
Descendants of 1
Quiz
Who are the descendants of 5?
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 12 / 59
Quiz
Example (Another Node Tree)
1
2
3 4
5 6 7
8
9
A
B
C
D E F
G
H I
J
Questions
Parent of E?
Children of 2?
Descendants of 2?
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 13 / 59
Outline
1 Introduction
2 Tree Terminology
3 Location Path and Steps
4 XPath Path Expressions
5 Axes
6 Summary
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 14 / 59
Location Path and Location Step I
Definition (Location Path)
A location path evaluates to a sequence of nodes
Example (Location Path)
/child::coursecatalog/child::course[name=’OOP’or name=’DB’][@id<10]
Definition (Location Step)
A location path consists of a number of location steps.
Example (Location Steps)
child::coursecatalog
child::course[name=’OOP’or name=’DB’][@id<10]
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 15 / 59
Location Path and Location Step II
Definition
A location step consists of an axis, a node test, and a set of predicates
Example (One)
child::coursecatalog
Axis: child
Node test: coursecatalog
Predicates: empty
Example (Two)
child::course[name=’OOP’or name=’DB’][@id<10]
Axis: child
Node test: course
Predicates: [name=’OOP’or name=’DB’][@id<10]
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 16 / 59
Abbreviations
Most Used
Abbreviation Meaning
. self::node()
.. parent::node()
//coursecatalog /descendant-or-self::coursecatalog
course child::course
Example (Abbreviations in Action)
Abbreviation Meaning
//name /descendant-or-self::name
//name/.. /descendant-or-self::name/parent::node()
/coursecatalog/course /child::coursecatalog/child::course
Note
Abbreviations makes the expression more readable
Sometimes abbreviations can make it hard to guess the result
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 17 / 59
Evaluation of Location Path I
Example XML Document
/
coursecatalog
course
id=4 name
OOP
semester
3
desc
snip
course
id=2 name
DB
semester
7
desc
snip
Evalute the Location Path
/child::coursecatalog/child::course[name=’OOP’or name=’DB’][@id<10]/name
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 18 / 59
Evaluation of Location Path II
The Steps in the Evaluation
1 Starts with / therefore the context node is set to root node
2 Evaluate the location step child::coursecatalog
3 Result is the coursecatalog root element node
4 Set context to root element node
5 Evaluate the location step
child::course[name=’OOP’or name=’DB’][@id<10]
6 The result is the two course element nodes
7 Set context to the OOP course element node
8 Evaluate the location step child::name
9 Results in the name element node which is the first part of the result
10 Set context to the DB course element node
11 Evaluate the location step child::name
12 Results in the name element node which is the last part of the result
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 19 / 59
Context
Definition (Context)
A context node (a node in the node tree)
A context size and context position
A set of variable bindings
A function library
A set of name space declaration
Definition (Context Size)
The context size is the lenght of the sequence of nodes return by the
previous location step
Definition (Context Position)
The context position is the current node in the sequence being evaluated
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 20 / 59
Outline
1 Introduction
2 Tree Terminology
3 Location Path and Steps
4 XPath Path Expressions
5 Axes
6 Summary
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 21 / 59
Compact Notation for Node Tree
Example (The Node Tree)
/
coursecatalog
course
id=4 name
OOP
semester
3
desc
snip
course
id=2 name
DB
semester
7
desc
snip
Example (The Equivalent Compact Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 22 / 59
Example: Find the Courses
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
/coursecatalog/course
Result
course:OOP
id=4 name:OOP sem:3 dsc
course:DB
id=2 name:DB sem:3 dsc
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 23 / 59
Example: Find Elements That Do Not Exist
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
/coursecatalog/name
Result
Empty no name element below coursecatalog!
Note that it is not an error!
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 24 / 59
Example: Find the Course Names
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
/coursecatalog//name
Result
name:OOP name:DB
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 25 / 59
Examples: Find the OOP Course
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
/coursecatalog/course[name="OOP"]
Result
course:OOP
id=4 name:OOP sem:3 dsc
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 26 / 59
Example: Find a Course Based on ID
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
/coursecatalog/course[@id="2"]
Result
course:DB
id=2 name:DB sem:7 dsc
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 27 / 59
Example: Filter on an Attribute
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
/coursecatalog/course[@id="2"]/name
Result
name:DB
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 28 / 59
Example: Get the Name of a Course as a String
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
/coursecatalog/course[@id="2"]/name/text()
Result
The string DB
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 29 / 59
Example: Use Parent Axis
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
//course[@id="2"]/parent::node()
Result
The document node, i.e., the entire tree
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 30 / 59
Example: Use Child Axis
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
/coursecatalog/child::node()
Result
course:OOP
id=4 name:OOP sem:3 dsc
course:DB
id=2 name:DB sem:7 dsc
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 31 / 59
Example: Use Descendant Axis
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
/coursecatalog/descendant::node()
Result
8 element nodes
6 text nodes
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 32 / 59
Example: Use Functions
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
concat("hello, ", "world!")
Result
The string ’hello, world!’
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 33 / 59
Example: Functions and XPath Expressions
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Query
concat("hello ", /coursecatalog/course[@id="2"]/name/text())
Result
The string ’hello DB’
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 34 / 59
Most used Path Expressions
Often Used Expressions
Path Expression Description
/ select from the root node
//NodeName select NodeName element nodes
. select the current node
.. select parent of the current node
/NodeName[@id>7] select based on attribute node
/NodeName[Node2=’H’] select based on element node
/NodeName/text() select the text node value
/NodeName/attribute() select the attribute nodes
/NodeName[1] select the first NodeName element node
/NodeName[last()] select the last NodeName element node
Note
Almost like Linux/Unix directory navigation
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 35 / 59
Quiz
Example (Node Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Questions
/coursecatalog/course/name returns?
/coursecatalog/teacher returns?
/coursecatalog is the same as /?
/coursecatalog/course/../course/../course returns?
/coursecatalog/course[@id<11]/name/text() returns?
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 36 / 59
Outline
1 Introduction
2 Tree Terminology
3 Location Path and Steps
4 XPath Path Expressions
5 Axes
6 Summary
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 37 / 59
Node Numbering
Example (Node Tree)
1
2
3 4
5
6
7
8 9
10 11
12 13 14
Note
Depth-first numbering of nodes
Used for relative access to other nodes
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 38 / 59
Forward and Backward Axes
Definition (Axis)
An axis is a sequence of nodes located relative to the context node.
Definition (Forward Axis)
A forward axis can only return the context node or nodes after in the
document order.
Definition (Backward Axis)
An backward axis can only return the context node or nodes that are
before in the document order.
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 39 / 59
The Axes
Axis Name Direction Description
attribute forward All my attributes
self forward My self
child forward All my children
descendant forward All my children, grand children, etc.
parent backward My unique parent
ancestor backward My parent, grand parent, etc.
following forward All after me that are not ancestors
preceding backward All before me that are not ancestors
following-sibling forward My “younger” siblings
preceding-sibling backward My “elder” siblings
descendant-or-self forward My self and all my descendants
ancestor-or-self backward My self or my ancestors
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 40 / 59
Child
Finds
Immediately descendants to current node.
Numbering
1
2
3 4
5
6
7
8 9
10 11
12 13 14
Example
cur
1 2 3
Quiz
Which direction of the child axis (and why)?
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 41 / 59
Child Examples
Example (Document Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Queries
/coursecatalog/child::node()
Result: the two course nodes
/coursecatalog/course/child::node()
Result: six element nodes
/coursecatalog/course/attribute()
Result: two attribute nodes
/coursecatalog/course/semester/child::node()
Result: two text nodes
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 42 / 59
Parent
Finds
The one node immediately above
Numbering
1
2
3 4
5
6
7
8 9
10 11
12 13 14
Example
1
cur
Quiz
Which direction of the parent axis (and why)?
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 43 / 59
Parent Examples
Example (Document Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Queries
/coursecatalog/course[@id=’2’]/name/parent::node()
Result: the course element node with id = 2
/coursecatalog/course/name/parent::node()
Result: the two course element nodes
/coursecatalog/parent::node()
Result: the document root
/parent::node()
Result: empty
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 44 / 59
Descendent
Finds
Children all the way down the tree
Numbering
1
2
3 4
5
6
7
8 9
10 11
12 13 14
Example
cur
1
2 3
4 5
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 45 / 59
Descendant Examples
Example (Document Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Queries
/coursecatalog/descendant::node()
Result: 8 element nodes + 6 text nodes
/coursecatalog/course[name="OOP"]/descendant::node()
Result: 3 element nodes + 3 text nodes
/coursecatalog/course[name="OOP"]/descendant::node()/attribute()
Result: 2 attribute nodes
/coursecatalog/course/name/descendant::node()
Result: two text nodes
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 46 / 59
Ancestor
Finds
Parents all the way up the tree
Numbering
1
2
3 4
5
6
7
8 9
10 11
12 13 14
Example
4
3
2
1
cur
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 47 / 59
Ancestor Examples
Example (Document Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Queries
/coursecatalog/course[name="DB"]/desc/ancestor::node()[2]
Result: course-catalog element node
/coursecatalog/course/name/ancestor::node()
Result: document node + coursecatalog node + 2 course nodes
/coursecatalog/ancestor::node()
Result: document root
/ancestor::node()
Result: empty
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 48 / 59
Following
Finds
All nodes that follows excluding descendants
Numbering
1
2
3 4
5
6
7
8 9
10 11
12 13 14
Example
cur 1 2
3 4 5
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 49 / 59
Following Examples
Example (Document Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Queries
/coursecatalog/course[@id="4"]/following::node()
Result: 4 element nodes + 3 text nodes
/coursecatalog/course[@id="2"]/following::node()
Result: empty
/coursecatalog/course[@id="4"]/name/text()/following::node()
Result: 6 element nodes and 5 text nodes
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 50 / 59
Preceding
Finds
All preceding nodes excluding ancestors
Numbering
1
2
3 4
5
6
7
8 9
10 11
12 13 14
Example
3
2 1
cur
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 51 / 59
Preceding Examples
Example (Document Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Queries
/coursecatalog/course[@id="4"]/semester/text()/preceding::node()
Result: 1 element node + 1 text node, root element is anscestor
/coursecatalog/course/preceding::node()
Result: the OOP course 4 element nodes + 3 text nodes
/coursecatalog/course[name="OOP"]/preceding::node()
Result: empty
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 52 / 59
Following Sibling
Finds
All siblings nodes following
Numbering
1
2
3 4
5
6
7
8 9
10 11
12 13 14
Example
cur 1 2 3
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 53 / 59
Following Sibling Examples
Example (Document Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Queries
/coursecatalog/course/following-sibling::node()
Result: 1 element node (the DB course)
/coursecatalog/course[@id="2"]/following-sibling::node()
Result: empty
/coursecatalog/course/semester/following-sibling::node()
Result: 2 element nodes (descriptions)
/coursecatalog/course/@id/following-sibling::node()
Result: empty
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 54 / 59
Preceding Sibling
Finds
All siblings nodes before
Numbering
1
2
3 4
5
6
7
8 9
10 11
12 13 14
Example
2 1 cur
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 55 / 59
Preceding Sibling Examples
Example (Document Tree)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Queries
/coursecatalog/course/preceding-sibling::node()
Result: 1 element node (the OOP course)
/coursecatalog/course[@id="2"]/preceding-sibling::node()
Result: 1 element node (the OOP course)
/coursecatalog/course/semester/preceding-sibling::node()
Result: 2 element nodes (names)
/coursecatalog/course/desc/preceding-sibling::node()
Result: 4 element nodes (0 attribute nodes)
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 56 / 59
Outline
1 Introduction
2 Tree Terminology
3 Location Path and Steps
4 XPath Path Expressions
5 Axes
6 Summary
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 57 / 59
Summary: XPath
Main Points
XPath is widely used
Not an XML syntax!
XPath is used for many purposes in related XML technologies
XQuery
XSLT
SQL/XML
W3C Recommendation November 1999 www.w3.org/TR/xpath
Note
Very good idea to get familiar with XPath
XPath is the foundation for understanding other XML technologies
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 58 / 59
Additional Information
Web Sites
www.w3schools.com/XPath/xpath_intro.asp: W3C is always a
good place to start
www.stylusstudio.com/w3c/xpath/: A very good and quite
elaborated tutorial
www.devarticles.com/c/a/XML/Introduction-to-XPath/: Good
4 page tutorial
pierre.senellart.com/wdmd/chap-xpath.pdf: A description of
the XPath data model
Tools
pgfearo.googlepages.com/: A very good tool for playing around
with XPath
There is an introduction screencast
http://www.bit-101.com/xpath/: A good online tool
Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 59 / 59

Weitere ähnliche Inhalte

Was ist angesagt?

Hadoop basic commands
Hadoop basic commandsHadoop basic commands
Hadoop basic commandsbispsolutions
 
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...Databricks
 
Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017
Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017
Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017AWS Chicago
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaEdureka!
 
Spark + Parquet In Depth: Spark Summit East Talk by Emily Curtin and Robbie S...
Spark + Parquet In Depth: Spark Summit East Talk by Emily Curtin and Robbie S...Spark + Parquet In Depth: Spark Summit East Talk by Emily Curtin and Robbie S...
Spark + Parquet In Depth: Spark Summit East Talk by Emily Curtin and Robbie S...Spark Summit
 
Scaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter ExperienceScaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter ExperienceDataWorks Summit
 
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...Databricks
 
Topic Modeling - NLP
Topic Modeling - NLPTopic Modeling - NLP
Topic Modeling - NLPRupak Roy
 
How to boost your datamanagement with Dremio ?
How to boost your datamanagement with Dremio ?How to boost your datamanagement with Dremio ?
How to boost your datamanagement with Dremio ?Vincent Terrasi
 
The Apache Spark File Format Ecosystem
The Apache Spark File Format EcosystemThe Apache Spark File Format Ecosystem
The Apache Spark File Format EcosystemDatabricks
 
Best Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache SparkBest Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache SparkDatabricks
 
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...Flink Forward
 
Introduction to Spark Streaming
Introduction to Spark StreamingIntroduction to Spark Streaming
Introduction to Spark Streamingdatamantra
 
My SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMy SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMarkus Flechtner
 
Summary introduction to data engineering
Summary introduction to data engineeringSummary introduction to data engineering
Summary introduction to data engineeringNovita Sari
 
Oracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best PracticesOracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best PracticesBobby Curtis
 
Exploring the Oracle Database Architecture.ppt
Exploring the Oracle Database Architecture.pptExploring the Oracle Database Architecture.ppt
Exploring the Oracle Database Architecture.pptMohammedHdi1
 
Design, Scale and Performance of MapR's Distribution for Hadoop
Design, Scale and Performance of MapR's Distribution for HadoopDesign, Scale and Performance of MapR's Distribution for Hadoop
Design, Scale and Performance of MapR's Distribution for Hadoopmcsrivas
 

Was ist angesagt? (20)

SPARQL Cheat Sheet
SPARQL Cheat SheetSPARQL Cheat Sheet
SPARQL Cheat Sheet
 
Hadoop basic commands
Hadoop basic commandsHadoop basic commands
Hadoop basic commands
 
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
 
Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017
Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017
Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
 
Spark + Parquet In Depth: Spark Summit East Talk by Emily Curtin and Robbie S...
Spark + Parquet In Depth: Spark Summit East Talk by Emily Curtin and Robbie S...Spark + Parquet In Depth: Spark Summit East Talk by Emily Curtin and Robbie S...
Spark + Parquet In Depth: Spark Summit East Talk by Emily Curtin and Robbie S...
 
Scaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter ExperienceScaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter Experience
 
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
 
Topic Modeling - NLP
Topic Modeling - NLPTopic Modeling - NLP
Topic Modeling - NLP
 
How to boost your datamanagement with Dremio ?
How to boost your datamanagement with Dremio ?How to boost your datamanagement with Dremio ?
How to boost your datamanagement with Dremio ?
 
The Apache Spark File Format Ecosystem
The Apache Spark File Format EcosystemThe Apache Spark File Format Ecosystem
The Apache Spark File Format Ecosystem
 
Best Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache SparkBest Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache Spark
 
Spark
SparkSpark
Spark
 
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...
 
Introduction to Spark Streaming
Introduction to Spark StreamingIntroduction to Spark Streaming
Introduction to Spark Streaming
 
My SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMy SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please help
 
Summary introduction to data engineering
Summary introduction to data engineeringSummary introduction to data engineering
Summary introduction to data engineering
 
Oracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best PracticesOracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best Practices
 
Exploring the Oracle Database Architecture.ppt
Exploring the Oracle Database Architecture.pptExploring the Oracle Database Architecture.ppt
Exploring the Oracle Database Architecture.ppt
 
Design, Scale and Performance of MapR's Distribution for Hadoop
Design, Scale and Performance of MapR's Distribution for HadoopDesign, Scale and Performance of MapR's Distribution for Hadoop
Design, Scale and Performance of MapR's Distribution for Hadoop
 

Andere mochten auch

Andere mochten auch (8)

Xpath presentation
Xpath presentationXpath presentation
Xpath presentation
 
Xpath
XpathXpath
Xpath
 
XPath - XML Path Language
XPath - XML Path LanguageXPath - XML Path Language
XPath - XML Path Language
 
Introduction to JCR
Introduction to JCR Introduction to JCR
Introduction to JCR
 
LDM Slides: Data Modeling for XML and JSON
LDM Slides: Data Modeling for XML and JSONLDM Slides: Data Modeling for XML and JSON
LDM Slides: Data Modeling for XML and JSON
 
JCR In 10 Minutes
JCR In 10 MinutesJCR In 10 Minutes
JCR In 10 Minutes
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 

Ähnlich wie Introduction to XPath

Introduction to XML and Databases
Introduction to XML and DatabasesIntroduction to XML and Databases
Introduction to XML and Databasestorp42
 
Introduction to DTD
Introduction to DTDIntroduction to DTD
Introduction to DTDtorp42
 
XML on SQL Server
XML on SQL ServerXML on SQL Server
XML on SQL Servertorp42
 
SQL/XML on Oracle
SQL/XML on OracleSQL/XML on Oracle
SQL/XML on Oracletorp42
 
Querying XML: XPath and XQuery
Querying XML: XPath and XQueryQuerying XML: XPath and XQuery
Querying XML: XPath and XQueryKatrien Verbert
 
XPath XSLT Workshop - Concept Listing
XPath XSLT Workshop - Concept ListingXPath XSLT Workshop - Concept Listing
XPath XSLT Workshop - Concept ListingIndrajeet Verma
 
Alannah fitzgerald The TOETOE project planning for impact
Alannah fitzgerald The TOETOE project planning for impactAlannah fitzgerald The TOETOE project planning for impact
Alannah fitzgerald The TOETOE project planning for impactLORO
 
Sentiment analysis using naive bayes classifier
Sentiment analysis using naive bayes classifier Sentiment analysis using naive bayes classifier
Sentiment analysis using naive bayes classifier Dev Sahu
 
Spatial Indexing
Spatial IndexingSpatial Indexing
Spatial Indexingtorp42
 
Haystack 2018 - Algorithmic Extraction of Keywords Concepts and Vocabularies
Haystack 2018 - Algorithmic Extraction of Keywords Concepts and VocabulariesHaystack 2018 - Algorithmic Extraction of Keywords Concepts and Vocabularies
Haystack 2018 - Algorithmic Extraction of Keywords Concepts and VocabulariesMax Irwin
 
Temporal Databases: Data Models
Temporal Databases: Data ModelsTemporal Databases: Data Models
Temporal Databases: Data Modelstorp42
 
Q931+log reference en le cs
Q931+log reference en le csQ931+log reference en le cs
Q931+log reference en le csAFATous
 
Looking ahead in your DBA program, the final step in the course sequ.docx
Looking ahead in your DBA program, the final step in the course sequ.docxLooking ahead in your DBA program, the final step in the course sequ.docx
Looking ahead in your DBA program, the final step in the course sequ.docxwashingtonrosy
 
Information extraction for Free Text
Information extraction for Free TextInformation extraction for Free Text
Information extraction for Free Textbutest
 
Enhancing the labelling technique of
Enhancing the labelling technique ofEnhancing the labelling technique of
Enhancing the labelling technique ofIJDKP
 
Model of semantic textual document clustering
Model of semantic textual document clusteringModel of semantic textual document clustering
Model of semantic textual document clusteringSK Ahammad Fahad
 

Ähnlich wie Introduction to XPath (20)

Introduction to XML and Databases
Introduction to XML and DatabasesIntroduction to XML and Databases
Introduction to XML and Databases
 
Introduction to DTD
Introduction to DTDIntroduction to DTD
Introduction to DTD
 
XML on SQL Server
XML on SQL ServerXML on SQL Server
XML on SQL Server
 
SQL/XML on Oracle
SQL/XML on OracleSQL/XML on Oracle
SQL/XML on Oracle
 
Querying XML: XPath and XQuery
Querying XML: XPath and XQueryQuerying XML: XPath and XQuery
Querying XML: XPath and XQuery
 
XPath XSLT Workshop - Concept Listing
XPath XSLT Workshop - Concept ListingXPath XSLT Workshop - Concept Listing
XPath XSLT Workshop - Concept Listing
 
Alannah fitzgerald The TOETOE project planning for impact
Alannah fitzgerald The TOETOE project planning for impactAlannah fitzgerald The TOETOE project planning for impact
Alannah fitzgerald The TOETOE project planning for impact
 
Sentiment analysis using naive bayes classifier
Sentiment analysis using naive bayes classifier Sentiment analysis using naive bayes classifier
Sentiment analysis using naive bayes classifier
 
Meow Hagedorn
Meow HagedornMeow Hagedorn
Meow Hagedorn
 
Spatial Indexing
Spatial IndexingSpatial Indexing
Spatial Indexing
 
Haystack 2018 - Algorithmic Extraction of Keywords Concepts and Vocabularies
Haystack 2018 - Algorithmic Extraction of Keywords Concepts and VocabulariesHaystack 2018 - Algorithmic Extraction of Keywords Concepts and Vocabularies
Haystack 2018 - Algorithmic Extraction of Keywords Concepts and Vocabularies
 
Temporal Databases: Data Models
Temporal Databases: Data ModelsTemporal Databases: Data Models
Temporal Databases: Data Models
 
DL'12 dl-lite explanations
DL'12 dl-lite explanationsDL'12 dl-lite explanations
DL'12 dl-lite explanations
 
Q931+log reference en le cs
Q931+log reference en le csQ931+log reference en le cs
Q931+log reference en le cs
 
Looking ahead in your DBA program, the final step in the course sequ.docx
Looking ahead in your DBA program, the final step in the course sequ.docxLooking ahead in your DBA program, the final step in the course sequ.docx
Looking ahead in your DBA program, the final step in the course sequ.docx
 
Thesis writing
Thesis writingThesis writing
Thesis writing
 
Packing and Unpacking the Bag of Words: Introducing a Toolkit for Inductive A...
Packing and Unpacking the Bag of Words: Introducing a Toolkit for Inductive A...Packing and Unpacking the Bag of Words: Introducing a Toolkit for Inductive A...
Packing and Unpacking the Bag of Words: Introducing a Toolkit for Inductive A...
 
Information extraction for Free Text
Information extraction for Free TextInformation extraction for Free Text
Information extraction for Free Text
 
Enhancing the labelling technique of
Enhancing the labelling technique ofEnhancing the labelling technique of
Enhancing the labelling technique of
 
Model of semantic textual document clustering
Model of semantic textual document clusteringModel of semantic textual document clustering
Model of semantic textual document clustering
 

Kürzlich hochgeladen

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Kürzlich hochgeladen (20)

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

Introduction to XPath

  • 1. Introduction to XPath Kristian Torp Department of Computer Science Aalborg University people.cs.aau.dk/˜torp torp@cs.aau.dk November 3, 2015 daisy.aau.dk Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 1 / 59
  • 2. Outline 1 Introduction 2 Tree Terminology 3 Location Path and Steps 4 XPath Path Expressions 5 Axes 6 Summary Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 2 / 59
  • 3. Learning Goals and Focus Learning Goals Understand the XPath data model Know the basic tree terminology Good at querying XML documents using XPath Know the abbreviations used in XPath Very handy to know in practice Compact and quite readable! Database Focus All XML technologies are presented from a database perspective also called a data focus (i.e., not a document focus)! Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 3 / 59
  • 4. Outline 1 Introduction 2 Tree Terminology 3 Location Path and Steps 4 XPath Path Expressions 5 Axes 6 Summary Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 4 / 59
  • 5. Introduction Example Find all courses: /coursecatalog/course Find the semesters: //semester/text() Overview A language for finding/addressing information in XML documents navigating through elements and attributes in an XML document Used in many XML technologies, e.g., XQuery and XPointer A part of the XSLT recommendation Microsoft/Visual Studio makes heavy usage of XSLT The data model is an abstract and logical structure of an XML document Called a node tree Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 5 / 59
  • 6. The Node Tree Terminology Document node: The entire XML document Also called the document root or the root node Element node: An XML element A special one is the document element or root element Text node: The text strings in an element node Attribute node: An attribute Example (A Node Tree) / coursecatalog course id=4 name OOP semester 3 desc snip course id=2 name DB semester 7 desc snip Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 6 / 59
  • 7. Example: Find the Courses Example (Document) / coursecatalog course id=4 name OOP semester 3 desc snip course id=2 name DB semester 7 desc snip Query /coursecatalog/course Result course id=4 name OOP semester 3 desc snip course id=2 name DB semester 7 desc snip Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 7 / 59
  • 8. Example: Find the Semesters Example (Document) / coursecatalog course id=4 name OOP semester 3 desc snip course id=2 name DB semester 7 desc snip Query //semester/text() Result 3 7 Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 8 / 59
  • 9. Major Components Components Nodes XML document treated as a tree of nodes Examples: Elements, attributes, and comments Path expressions Select a set of nodes in an XML document Examples: /, /coursecatalog/course Standard functions Approximate 100 built-in functions Examples: concat(’a’, ’b’), round(1.5) Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 9 / 59
  • 10. Quiz Example (Document) / coursecatalog course id=4 name OOP semester 3 desc snip course id=2 name DB semester 7 desc snip Questions Who is the parent of the document element? How many document elements are there in an XML document? How many elements can there be in an XML document? Are elements and attributes the same node type? Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 10 / 59
  • 11. Outline 1 Introduction 2 Tree Terminology 3 Location Path and Steps 4 XPath Path Expressions 5 Axes 6 Summary Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 11 / 59
  • 12. Tree Terminology Example (A Node Tree) 1 2 3 4 5 6 7 8 9 A B Tree Like any other tree in CS
  • 13. Tree Terminology Example (A Node Tree) 1 2 3 4 5 6 7 8 9 A B Root Quiz Are there other roots?
  • 14. Tree Terminology Example (A Node Tree) 1 2 3 4 5 6 7 8 9 A B Leafs Quiz Are there more leafs?
  • 15. Tree Terminology Example (A Node Tree) 1 2 3 4 5 6 7 8 9 A B Children of 1 Quiz Who are the children of 3? Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 12 / 59
  • 16. Tree Terminology Example (A Node Tree) 1 2 3 4 5 6 7 8 9 A B Siblings of 9 Quiz Who are the siblings of 3? Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 12 / 59
  • 17. Tree Terminology Example (A Node Tree) 1 2 3 4 5 6 7 8 9 A B Ancestors of 6 Quiz Who are the ancestors of 9? Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 12 / 59
  • 18. Tree Terminology Example (A Node Tree) 1 2 3 4 5 6 7 8 9 A B Parent of 8 Quiz Who are the parents of 4? Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 12 / 59
  • 19. Tree Terminology Example (A Node Tree) 1 2 3 4 5 6 7 8 9 A B Descendants of 1 Quiz Who are the descendants of 5? Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 12 / 59
  • 20. Quiz Example (Another Node Tree) 1 2 3 4 5 6 7 8 9 A B C D E F G H I J Questions Parent of E? Children of 2? Descendants of 2? Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 13 / 59
  • 21. Outline 1 Introduction 2 Tree Terminology 3 Location Path and Steps 4 XPath Path Expressions 5 Axes 6 Summary Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 14 / 59
  • 22. Location Path and Location Step I Definition (Location Path) A location path evaluates to a sequence of nodes Example (Location Path) /child::coursecatalog/child::course[name=’OOP’or name=’DB’][@id<10] Definition (Location Step) A location path consists of a number of location steps. Example (Location Steps) child::coursecatalog child::course[name=’OOP’or name=’DB’][@id<10] Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 15 / 59
  • 23. Location Path and Location Step II Definition A location step consists of an axis, a node test, and a set of predicates Example (One) child::coursecatalog Axis: child Node test: coursecatalog Predicates: empty Example (Two) child::course[name=’OOP’or name=’DB’][@id<10] Axis: child Node test: course Predicates: [name=’OOP’or name=’DB’][@id<10] Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 16 / 59
  • 24. Abbreviations Most Used Abbreviation Meaning . self::node() .. parent::node() //coursecatalog /descendant-or-self::coursecatalog course child::course Example (Abbreviations in Action) Abbreviation Meaning //name /descendant-or-self::name //name/.. /descendant-or-self::name/parent::node() /coursecatalog/course /child::coursecatalog/child::course Note Abbreviations makes the expression more readable Sometimes abbreviations can make it hard to guess the result Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 17 / 59
  • 25. Evaluation of Location Path I Example XML Document / coursecatalog course id=4 name OOP semester 3 desc snip course id=2 name DB semester 7 desc snip Evalute the Location Path /child::coursecatalog/child::course[name=’OOP’or name=’DB’][@id<10]/name Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 18 / 59
  • 26. Evaluation of Location Path II The Steps in the Evaluation 1 Starts with / therefore the context node is set to root node 2 Evaluate the location step child::coursecatalog 3 Result is the coursecatalog root element node 4 Set context to root element node 5 Evaluate the location step child::course[name=’OOP’or name=’DB’][@id<10] 6 The result is the two course element nodes 7 Set context to the OOP course element node 8 Evaluate the location step child::name 9 Results in the name element node which is the first part of the result 10 Set context to the DB course element node 11 Evaluate the location step child::name 12 Results in the name element node which is the last part of the result Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 19 / 59
  • 27. Context Definition (Context) A context node (a node in the node tree) A context size and context position A set of variable bindings A function library A set of name space declaration Definition (Context Size) The context size is the lenght of the sequence of nodes return by the previous location step Definition (Context Position) The context position is the current node in the sequence being evaluated Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 20 / 59
  • 28. Outline 1 Introduction 2 Tree Terminology 3 Location Path and Steps 4 XPath Path Expressions 5 Axes 6 Summary Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 21 / 59
  • 29. Compact Notation for Node Tree Example (The Node Tree) / coursecatalog course id=4 name OOP semester 3 desc snip course id=2 name DB semester 7 desc snip Example (The Equivalent Compact Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 22 / 59
  • 30. Example: Find the Courses Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query /coursecatalog/course Result course:OOP id=4 name:OOP sem:3 dsc course:DB id=2 name:DB sem:3 dsc Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 23 / 59
  • 31. Example: Find Elements That Do Not Exist Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query /coursecatalog/name Result Empty no name element below coursecatalog! Note that it is not an error! Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 24 / 59
  • 32. Example: Find the Course Names Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query /coursecatalog//name Result name:OOP name:DB Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 25 / 59
  • 33. Examples: Find the OOP Course Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query /coursecatalog/course[name="OOP"] Result course:OOP id=4 name:OOP sem:3 dsc Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 26 / 59
  • 34. Example: Find a Course Based on ID Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query /coursecatalog/course[@id="2"] Result course:DB id=2 name:DB sem:7 dsc Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 27 / 59
  • 35. Example: Filter on an Attribute Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query /coursecatalog/course[@id="2"]/name Result name:DB Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 28 / 59
  • 36. Example: Get the Name of a Course as a String Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query /coursecatalog/course[@id="2"]/name/text() Result The string DB Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 29 / 59
  • 37. Example: Use Parent Axis Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query //course[@id="2"]/parent::node() Result The document node, i.e., the entire tree Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 30 / 59
  • 38. Example: Use Child Axis Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query /coursecatalog/child::node() Result course:OOP id=4 name:OOP sem:3 dsc course:DB id=2 name:DB sem:7 dsc Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 31 / 59
  • 39. Example: Use Descendant Axis Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query /coursecatalog/descendant::node() Result 8 element nodes 6 text nodes Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 32 / 59
  • 40. Example: Use Functions Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query concat("hello, ", "world!") Result The string ’hello, world!’ Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 33 / 59
  • 41. Example: Functions and XPath Expressions Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Query concat("hello ", /coursecatalog/course[@id="2"]/name/text()) Result The string ’hello DB’ Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 34 / 59
  • 42. Most used Path Expressions Often Used Expressions Path Expression Description / select from the root node //NodeName select NodeName element nodes . select the current node .. select parent of the current node /NodeName[@id>7] select based on attribute node /NodeName[Node2=’H’] select based on element node /NodeName/text() select the text node value /NodeName/attribute() select the attribute nodes /NodeName[1] select the first NodeName element node /NodeName[last()] select the last NodeName element node Note Almost like Linux/Unix directory navigation Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 35 / 59
  • 43. Quiz Example (Node Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Questions /coursecatalog/course/name returns? /coursecatalog/teacher returns? /coursecatalog is the same as /? /coursecatalog/course/../course/../course returns? /coursecatalog/course[@id<11]/name/text() returns? Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 36 / 59
  • 44. Outline 1 Introduction 2 Tree Terminology 3 Location Path and Steps 4 XPath Path Expressions 5 Axes 6 Summary Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 37 / 59
  • 45. Node Numbering Example (Node Tree) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Note Depth-first numbering of nodes Used for relative access to other nodes Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 38 / 59
  • 46. Forward and Backward Axes Definition (Axis) An axis is a sequence of nodes located relative to the context node. Definition (Forward Axis) A forward axis can only return the context node or nodes after in the document order. Definition (Backward Axis) An backward axis can only return the context node or nodes that are before in the document order. Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 39 / 59
  • 47. The Axes Axis Name Direction Description attribute forward All my attributes self forward My self child forward All my children descendant forward All my children, grand children, etc. parent backward My unique parent ancestor backward My parent, grand parent, etc. following forward All after me that are not ancestors preceding backward All before me that are not ancestors following-sibling forward My “younger” siblings preceding-sibling backward My “elder” siblings descendant-or-self forward My self and all my descendants ancestor-or-self backward My self or my ancestors Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 40 / 59
  • 48. Child Finds Immediately descendants to current node. Numbering 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Example cur 1 2 3 Quiz Which direction of the child axis (and why)? Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 41 / 59
  • 49. Child Examples Example (Document Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Queries /coursecatalog/child::node() Result: the two course nodes /coursecatalog/course/child::node() Result: six element nodes /coursecatalog/course/attribute() Result: two attribute nodes /coursecatalog/course/semester/child::node() Result: two text nodes Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 42 / 59
  • 50. Parent Finds The one node immediately above Numbering 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Example 1 cur Quiz Which direction of the parent axis (and why)? Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 43 / 59
  • 51. Parent Examples Example (Document Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Queries /coursecatalog/course[@id=’2’]/name/parent::node() Result: the course element node with id = 2 /coursecatalog/course/name/parent::node() Result: the two course element nodes /coursecatalog/parent::node() Result: the document root /parent::node() Result: empty Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 44 / 59
  • 52. Descendent Finds Children all the way down the tree Numbering 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Example cur 1 2 3 4 5 Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 45 / 59
  • 53. Descendant Examples Example (Document Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Queries /coursecatalog/descendant::node() Result: 8 element nodes + 6 text nodes /coursecatalog/course[name="OOP"]/descendant::node() Result: 3 element nodes + 3 text nodes /coursecatalog/course[name="OOP"]/descendant::node()/attribute() Result: 2 attribute nodes /coursecatalog/course/name/descendant::node() Result: two text nodes Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 46 / 59
  • 54. Ancestor Finds Parents all the way up the tree Numbering 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Example 4 3 2 1 cur Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 47 / 59
  • 55. Ancestor Examples Example (Document Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Queries /coursecatalog/course[name="DB"]/desc/ancestor::node()[2] Result: course-catalog element node /coursecatalog/course/name/ancestor::node() Result: document node + coursecatalog node + 2 course nodes /coursecatalog/ancestor::node() Result: document root /ancestor::node() Result: empty Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 48 / 59
  • 56. Following Finds All nodes that follows excluding descendants Numbering 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Example cur 1 2 3 4 5 Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 49 / 59
  • 57. Following Examples Example (Document Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Queries /coursecatalog/course[@id="4"]/following::node() Result: 4 element nodes + 3 text nodes /coursecatalog/course[@id="2"]/following::node() Result: empty /coursecatalog/course[@id="4"]/name/text()/following::node() Result: 6 element nodes and 5 text nodes Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 50 / 59
  • 58. Preceding Finds All preceding nodes excluding ancestors Numbering 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Example 3 2 1 cur Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 51 / 59
  • 59. Preceding Examples Example (Document Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Queries /coursecatalog/course[@id="4"]/semester/text()/preceding::node() Result: 1 element node + 1 text node, root element is anscestor /coursecatalog/course/preceding::node() Result: the OOP course 4 element nodes + 3 text nodes /coursecatalog/course[name="OOP"]/preceding::node() Result: empty Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 52 / 59
  • 60. Following Sibling Finds All siblings nodes following Numbering 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Example cur 1 2 3 Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 53 / 59
  • 61. Following Sibling Examples Example (Document Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Queries /coursecatalog/course/following-sibling::node() Result: 1 element node (the DB course) /coursecatalog/course[@id="2"]/following-sibling::node() Result: empty /coursecatalog/course/semester/following-sibling::node() Result: 2 element nodes (descriptions) /coursecatalog/course/@id/following-sibling::node() Result: empty Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 54 / 59
  • 62. Preceding Sibling Finds All siblings nodes before Numbering 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Example 2 1 cur Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 55 / 59
  • 63. Preceding Sibling Examples Example (Document Tree) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Queries /coursecatalog/course/preceding-sibling::node() Result: 1 element node (the OOP course) /coursecatalog/course[@id="2"]/preceding-sibling::node() Result: 1 element node (the OOP course) /coursecatalog/course/semester/preceding-sibling::node() Result: 2 element nodes (names) /coursecatalog/course/desc/preceding-sibling::node() Result: 4 element nodes (0 attribute nodes) Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 56 / 59
  • 64. Outline 1 Introduction 2 Tree Terminology 3 Location Path and Steps 4 XPath Path Expressions 5 Axes 6 Summary Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 57 / 59
  • 65. Summary: XPath Main Points XPath is widely used Not an XML syntax! XPath is used for many purposes in related XML technologies XQuery XSLT SQL/XML W3C Recommendation November 1999 www.w3.org/TR/xpath Note Very good idea to get familiar with XPath XPath is the foundation for understanding other XML technologies Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 58 / 59
  • 66. Additional Information Web Sites www.w3schools.com/XPath/xpath_intro.asp: W3C is always a good place to start www.stylusstudio.com/w3c/xpath/: A very good and quite elaborated tutorial www.devarticles.com/c/a/XML/Introduction-to-XPath/: Good 4 page tutorial pierre.senellart.com/wdmd/chap-xpath.pdf: A description of the XPath data model Tools pgfearo.googlepages.com/: A very good tool for playing around with XPath There is an introduction screencast http://www.bit-101.com/xpath/: A good online tool Kristian Torp (Aalborg University) Introduction to XPath November 3, 2015 59 / 59