SlideShare a Scribd company logo
XPath: An Introduction Stuart Myles
Objectives What is XPath? An introduction to the XPath 1.0 language XML refresher XPath basics What else can you do with XPath 1.0? Where to go for more information
XPathXML Path Language Path notation with slashes newsItem/rightsInfo/copyrightHolder recipe/ingredientList/ingredient Like UNIX directory paths or URLS
What is XPath? Syntax for defining parts of an XML document Locate elements or attributes Performing operations over data XPath contains a library of standard functions Numeric, string, boolean A major part of several XML standards XSLT, XQuery, XML Schema, Schematron
XPath Introduction:XML Refresher XML documents contain one or more elements, delimited by start and end tags <foo> </foo> Elements can be nested to any depth <foo>  <bar></bar> </foo>
XML Attributes and Text Content Elements can have attributes <foo lang=“fr”> 	  <bar id=“theOne” lang=“en”></bar> </foo> Elements can have text content <foo lang=“fr”> 	  <bar lang=“en”>theOne</bar> </foo> Empty elements have no children or text <foo></foo> A shorthand for writing empty elements <foo />
XML Namespaces Elements can be defined in different namespaces Namespaces look like URLs You can use xmlns to declare a default namespace <newsItemxmlns='http://iptc.org/std/nar/2006-10-01/'>   <itemMeta>    <title>Pope Blesses Astronauts</title>   </itemMeta></newsItem> newsItemis in the http://iptc.org/std/nar/2006-10-01/namespace itemMeta and title are also in the http://iptc.org/std/nar/2006-10-01/ ns Child elements inherit  from their parents
XML Namespace Prefixes You can use xmlns:prefix to declare a namespace and bind it to a prefix <nar:newsItemxmlns:nar='http://iptc.org/std/nar/2006-10-01/'>  <nar:itemMeta>    <nar:title>Pope Blesses Astronauts</nar:title>   </nar:itemMeta></nar:newsItem> newsItem is in the http://iptc.org/std/nar/2006-10-01/ namespace itemMeta and title are also in the http://iptc.org/std/nar/2006-10-01/ namespace To an XML parser, this document and the previous one are identical
XPath Crash CourseThe Basics: Selecting Elements The simplest XPath form: one or more tag names, separated by slashes (/) newsItem/itemMeta/title<- title under itemMeta Use * instead of a tag name to match anything newsItem/*/title <- title grandchildren of newsItem An empty tag searches all levels of the tree //title Every title element in the doc newsItem//title Every title under newsItem
XPath: Using Attributes Attribute values are indicated by @ @rel<- The rel attribute of the current element Element and Attribute values are tied by /@ link/@rel<- The rel attribute of the link element Use [] for conditional selections link[@rel] <- link element with a rel attribute link[@rel = “parent”] link[@size &lt; “1000”] link[not(@href)]
XPath and Namespaces XPath supports namespaces nitf:p <- The p element from the nitf namespace xhtml:p <- The p element from the xhtml ns nar:* <- Any element from the nar namespace @atom:* <- Any attribute from the atom ns Protip: if you can’t figure out why your XPath expression isn’t matching, check the namespace
What Else Can XPath Do?Numeric, String, Boolean Functions Publication/FilingMetadata[1] Publication/FilingMetadata[last()] Publication/FilingMetadata[last() - 1] FilingMetadata[position() mod 2 = 0] FilingMetadata[Category = “q” or Category = “j”] not(contains(SlugLine, “advisory”)) starts-with(FilingOnlineCode, “1”) And XPath 2.0 adds even more functions, including regular expressions
More XPath Information List of examples: http://msdn.microsoft.com/en-us/library/ms256086.aspx Introductory, interactive tutorial: http://www.zvon.org/comp/r/tut-XPath_1.html More advanced tutorial: http://www.ibm.com/developerworks/xml/tutorials/x-xpath/section2.html XPath chapter from XML in a Nutshell: http://oreilly.com/catalog/xmlnut/chapter/ch09.html

More Related Content

What's hot

Extracting data from xml
Extracting data from xmlExtracting data from xml
Extracting data from xml
Kumar
 
Querying XML: XPath and XQuery
Querying XML: XPath and XQueryQuerying XML: XPath and XQuery
Querying XML: XPath and XQuery
Katrien Verbert
 
X FILES
X FILESX FILES
Querring xml with xpath
Querring xml with xpath Querring xml with xpath
Querring xml with xpath
Malintha Adikari
 
Rendering XML Document
Rendering XML DocumentRendering XML Document
Rendering XML Document
yht4ever
 
Xpath
XpathXpath
Day2 xslt x_path_xquery
Day2 xslt x_path_xqueryDay2 xslt x_path_xquery
Day2 xslt x_path_xquery
XAVIERCONSULTANTS
 
Xpath1
Xpath1Xpath1
XQuery - a technical overview
XQuery -  a technical overviewXQuery -  a technical overview
XQuery - a technical overview
Loren Cahlander
 
XSLT presentation
XSLT presentationXSLT presentation
XSLT presentation
Miguel Angel Teheran Garcia
 
XML/XSLT
XML/XSLTXML/XSLT
XML/XSLT
thinkahead.net
 
Xslt tutorial
Xslt tutorialXslt tutorial
Xslt tutorial
Bijoy Kureekkal
 
XSLT
XSLTXSLT
Xml processing in scala
Xml processing in scalaXml processing in scala
Xml processing in scala
Knoldus Inc.
 
transforming xml using xsl and xslt
transforming xml using xsl and xslttransforming xml using xsl and xslt
transforming xml using xsl and xslt
Hemant Suthar
 
Xml and Co.
Xml and Co.Xml and Co.
Xml and Co.
Findik Dervis
 
linked_lists4
linked_lists4linked_lists4
linked_lists4
Mohamed Elsayed
 
linked_lists
linked_listslinked_lists
linked_lists
Mohamed Elsayed
 
Xml transformation language
Xml transformation languageXml transformation language
Xml transformation language
reshmavasudev
 
Xslt elements
Xslt elementsXslt elements
Xslt elements
Sindhu VL
 

What's hot (20)

Extracting data from xml
Extracting data from xmlExtracting data from xml
Extracting data from xml
 
Querying XML: XPath and XQuery
Querying XML: XPath and XQueryQuerying XML: XPath and XQuery
Querying XML: XPath and XQuery
 
X FILES
X FILESX FILES
X FILES
 
Querring xml with xpath
Querring xml with xpath Querring xml with xpath
Querring xml with xpath
 
Rendering XML Document
Rendering XML DocumentRendering XML Document
Rendering XML Document
 
Xpath
XpathXpath
Xpath
 
Day2 xslt x_path_xquery
Day2 xslt x_path_xqueryDay2 xslt x_path_xquery
Day2 xslt x_path_xquery
 
Xpath1
Xpath1Xpath1
Xpath1
 
XQuery - a technical overview
XQuery -  a technical overviewXQuery -  a technical overview
XQuery - a technical overview
 
XSLT presentation
XSLT presentationXSLT presentation
XSLT presentation
 
XML/XSLT
XML/XSLTXML/XSLT
XML/XSLT
 
Xslt tutorial
Xslt tutorialXslt tutorial
Xslt tutorial
 
XSLT
XSLTXSLT
XSLT
 
Xml processing in scala
Xml processing in scalaXml processing in scala
Xml processing in scala
 
transforming xml using xsl and xslt
transforming xml using xsl and xslttransforming xml using xsl and xslt
transforming xml using xsl and xslt
 
Xml and Co.
Xml and Co.Xml and Co.
Xml and Co.
 
linked_lists4
linked_lists4linked_lists4
linked_lists4
 
linked_lists
linked_listslinked_lists
linked_lists
 
Xml transformation language
Xml transformation languageXml transformation language
Xml transformation language
 
Xslt elements
Xslt elementsXslt elements
Xslt elements
 

Similar to XPath Introduction

Xml 1
Xml 1Xml 1
Learning XSLT
Learning XSLTLearning XSLT
Learning XSLT
Overdue Books LLC
 
Xml
XmlXml
Well Formed XML
Well Formed XMLWell Formed XML
CIS-189 Final Review
CIS-189 Final ReviewCIS-189 Final Review
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
Stephan Schmidt
 
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FOOverview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Suite Solutions
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
yht4ever
 
xml introduction in web technologies subject
xml introduction in web technologies subjectxml introduction in web technologies subject
xml introduction in web technologies subject
UdayKumar693239
 
Xml
XmlXml
Basic xml syntax
Basic xml syntaxBasic xml syntax
Basic xml syntax
Raghu nath
 
chapter 4 web authoring unit 4 xml.pptx
chapter 4 web authoring  unit 4 xml.pptxchapter 4 web authoring  unit 4 xml.pptx
chapter 4 web authoring unit 4 xml.pptx
amare63
 
EXtensible Markup Language
EXtensible Markup LanguageEXtensible Markup Language
EXtensible Markup Language
Prabhat gangwar
 
Xml
XmlXml
Xml Presentation-3
Xml Presentation-3Xml Presentation-3
Xml Presentation-3
Sudharsan S
 
Xml1111
Xml1111Xml1111
Xml1111
Sudharsan S
 
XML
XMLXML
Ch2 neworder
Ch2 neworderCh2 neworder
Ch2 neworder
davidlahr32
 
Xml intro1
Xml intro1Xml intro1
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
Dr.Saranya K.G
 

Similar to XPath Introduction (20)

Xml 1
Xml 1Xml 1
Xml 1
 
Learning XSLT
Learning XSLTLearning XSLT
Learning XSLT
 
Xml
XmlXml
Xml
 
Well Formed XML
Well Formed XMLWell Formed XML
Well Formed XML
 
CIS-189 Final Review
CIS-189 Final ReviewCIS-189 Final Review
CIS-189 Final Review
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
 
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FOOverview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
xml introduction in web technologies subject
xml introduction in web technologies subjectxml introduction in web technologies subject
xml introduction in web technologies subject
 
Xml
XmlXml
Xml
 
Basic xml syntax
Basic xml syntaxBasic xml syntax
Basic xml syntax
 
chapter 4 web authoring unit 4 xml.pptx
chapter 4 web authoring  unit 4 xml.pptxchapter 4 web authoring  unit 4 xml.pptx
chapter 4 web authoring unit 4 xml.pptx
 
EXtensible Markup Language
EXtensible Markup LanguageEXtensible Markup Language
EXtensible Markup Language
 
Xml
XmlXml
Xml
 
Xml Presentation-3
Xml Presentation-3Xml Presentation-3
Xml Presentation-3
 
Xml1111
Xml1111Xml1111
Xml1111
 
XML
XMLXML
XML
 
Ch2 neworder
Ch2 neworderCh2 neworder
Ch2 neworder
 
Xml intro1
Xml intro1Xml intro1
Xml intro1
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
 

More from Stuart Myles

IPTC Rights Statements For News
IPTC Rights Statements For NewsIPTC Rights Statements For News
IPTC Rights Statements For News
Stuart Myles
 
IPTC New Taxonomies Ideas
IPTC New Taxonomies IdeasIPTC New Taxonomies Ideas
IPTC New Taxonomies Ideas
Stuart Myles
 
IPTC Board Spring 2019
IPTC Board Spring 2019IPTC Board Spring 2019
IPTC Board Spring 2019
Stuart Myles
 
IPTC Spring 2019 Conference
IPTC Spring 2019 ConferenceIPTC Spring 2019 Conference
IPTC Spring 2019 Conference
Stuart Myles
 
Photomation or Fauxtomation?
Photomation or Fauxtomation?Photomation or Fauxtomation?
Photomation or Fauxtomation?
Stuart Myles
 
Image Tagging at the Associated Press
Image Tagging at the Associated PressImage Tagging at the Associated Press
Image Tagging at the Associated Press
Stuart Myles
 
IPTC Rights Working Group Toronto October 2018
IPTC Rights Working Group Toronto October 2018IPTC Rights Working Group Toronto October 2018
IPTC Rights Working Group Toronto October 2018
Stuart Myles
 
IPTC AGM 2018 Welcome
IPTC AGM 2018 WelcomeIPTC AGM 2018 Welcome
IPTC AGM 2018 Welcome
Stuart Myles
 
How Can We Make Algorithmic News More Transparent?
How Can We Make Algorithmic News More Transparent?How Can We Make Algorithmic News More Transparent?
How Can We Make Algorithmic News More Transparent?
Stuart Myles
 
IPTC EXTRA Spring 2018
IPTC EXTRA Spring 2018IPTC EXTRA Spring 2018
IPTC EXTRA Spring 2018
Stuart Myles
 
IPTC Machine Readable Rights for News and Media: Solving Three Challenges wit...
IPTC Machine Readable Rights for News and Media: Solving Three Challenges wit...IPTC Machine Readable Rights for News and Media: Solving Three Challenges wit...
IPTC Machine Readable Rights for News and Media: Solving Three Challenges wit...
Stuart Myles
 
Ap Taxonomy Localization Requirements and Challenges
Ap Taxonomy Localization Requirements and ChallengesAp Taxonomy Localization Requirements and Challenges
Ap Taxonomy Localization Requirements and Challenges
Stuart Myles
 
IPTC Spring Meeting Welcome To Athens April 2018
IPTC Spring Meeting Welcome To Athens April 2018IPTC Spring Meeting Welcome To Athens April 2018
IPTC Spring Meeting Welcome To Athens April 2018
Stuart Myles
 
Sustaining Television News Technical Challenges
Sustaining Television News Technical ChallengesSustaining Television News Technical Challenges
Sustaining Television News Technical Challenges
Stuart Myles
 
How to Train Your Classifier: Create a Serverless Machine Learning System wit...
How to Train Your Classifier: Create a Serverless Machine Learning System wit...How to Train Your Classifier: Create a Serverless Machine Learning System wit...
How to Train Your Classifier: Create a Serverless Machine Learning System wit...
Stuart Myles
 
The Search for IPTC's Next Managing Director
The Search for IPTC's Next Managing DirectorThe Search for IPTC's Next Managing Director
The Search for IPTC's Next Managing Director
Stuart Myles
 
IPTC Approach to News in JSON
IPTC Approach to News in JSONIPTC Approach to News in JSON
IPTC Approach to News in JSON
Stuart Myles
 
IPTC News in JSON November 2017
IPTC News in JSON November 2017IPTC News in JSON November 2017
IPTC News in JSON November 2017
Stuart Myles
 
IPTC EXTRA and EXTRA+ November 2017
IPTC EXTRA and EXTRA+ November 2017IPTC EXTRA and EXTRA+ November 2017
IPTC EXTRA and EXTRA+ November 2017
Stuart Myles
 
Welcome to Barcelona - IPTC November 2017
Welcome to Barcelona - IPTC November 2017Welcome to Barcelona - IPTC November 2017
Welcome to Barcelona - IPTC November 2017
Stuart Myles
 

More from Stuart Myles (20)

IPTC Rights Statements For News
IPTC Rights Statements For NewsIPTC Rights Statements For News
IPTC Rights Statements For News
 
IPTC New Taxonomies Ideas
IPTC New Taxonomies IdeasIPTC New Taxonomies Ideas
IPTC New Taxonomies Ideas
 
IPTC Board Spring 2019
IPTC Board Spring 2019IPTC Board Spring 2019
IPTC Board Spring 2019
 
IPTC Spring 2019 Conference
IPTC Spring 2019 ConferenceIPTC Spring 2019 Conference
IPTC Spring 2019 Conference
 
Photomation or Fauxtomation?
Photomation or Fauxtomation?Photomation or Fauxtomation?
Photomation or Fauxtomation?
 
Image Tagging at the Associated Press
Image Tagging at the Associated PressImage Tagging at the Associated Press
Image Tagging at the Associated Press
 
IPTC Rights Working Group Toronto October 2018
IPTC Rights Working Group Toronto October 2018IPTC Rights Working Group Toronto October 2018
IPTC Rights Working Group Toronto October 2018
 
IPTC AGM 2018 Welcome
IPTC AGM 2018 WelcomeIPTC AGM 2018 Welcome
IPTC AGM 2018 Welcome
 
How Can We Make Algorithmic News More Transparent?
How Can We Make Algorithmic News More Transparent?How Can We Make Algorithmic News More Transparent?
How Can We Make Algorithmic News More Transparent?
 
IPTC EXTRA Spring 2018
IPTC EXTRA Spring 2018IPTC EXTRA Spring 2018
IPTC EXTRA Spring 2018
 
IPTC Machine Readable Rights for News and Media: Solving Three Challenges wit...
IPTC Machine Readable Rights for News and Media: Solving Three Challenges wit...IPTC Machine Readable Rights for News and Media: Solving Three Challenges wit...
IPTC Machine Readable Rights for News and Media: Solving Three Challenges wit...
 
Ap Taxonomy Localization Requirements and Challenges
Ap Taxonomy Localization Requirements and ChallengesAp Taxonomy Localization Requirements and Challenges
Ap Taxonomy Localization Requirements and Challenges
 
IPTC Spring Meeting Welcome To Athens April 2018
IPTC Spring Meeting Welcome To Athens April 2018IPTC Spring Meeting Welcome To Athens April 2018
IPTC Spring Meeting Welcome To Athens April 2018
 
Sustaining Television News Technical Challenges
Sustaining Television News Technical ChallengesSustaining Television News Technical Challenges
Sustaining Television News Technical Challenges
 
How to Train Your Classifier: Create a Serverless Machine Learning System wit...
How to Train Your Classifier: Create a Serverless Machine Learning System wit...How to Train Your Classifier: Create a Serverless Machine Learning System wit...
How to Train Your Classifier: Create a Serverless Machine Learning System wit...
 
The Search for IPTC's Next Managing Director
The Search for IPTC's Next Managing DirectorThe Search for IPTC's Next Managing Director
The Search for IPTC's Next Managing Director
 
IPTC Approach to News in JSON
IPTC Approach to News in JSONIPTC Approach to News in JSON
IPTC Approach to News in JSON
 
IPTC News in JSON November 2017
IPTC News in JSON November 2017IPTC News in JSON November 2017
IPTC News in JSON November 2017
 
IPTC EXTRA and EXTRA+ November 2017
IPTC EXTRA and EXTRA+ November 2017IPTC EXTRA and EXTRA+ November 2017
IPTC EXTRA and EXTRA+ November 2017
 
Welcome to Barcelona - IPTC November 2017
Welcome to Barcelona - IPTC November 2017Welcome to Barcelona - IPTC November 2017
Welcome to Barcelona - IPTC November 2017
 

Recently uploaded

Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
christinelarrosa
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 

Recently uploaded (20)

Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 

XPath Introduction

  • 1. XPath: An Introduction Stuart Myles
  • 2. Objectives What is XPath? An introduction to the XPath 1.0 language XML refresher XPath basics What else can you do with XPath 1.0? Where to go for more information
  • 3. XPathXML Path Language Path notation with slashes newsItem/rightsInfo/copyrightHolder recipe/ingredientList/ingredient Like UNIX directory paths or URLS
  • 4. What is XPath? Syntax for defining parts of an XML document Locate elements or attributes Performing operations over data XPath contains a library of standard functions Numeric, string, boolean A major part of several XML standards XSLT, XQuery, XML Schema, Schematron
  • 5. XPath Introduction:XML Refresher XML documents contain one or more elements, delimited by start and end tags <foo> </foo> Elements can be nested to any depth <foo> <bar></bar> </foo>
  • 6. XML Attributes and Text Content Elements can have attributes <foo lang=“fr”> <bar id=“theOne” lang=“en”></bar> </foo> Elements can have text content <foo lang=“fr”> <bar lang=“en”>theOne</bar> </foo> Empty elements have no children or text <foo></foo> A shorthand for writing empty elements <foo />
  • 7. XML Namespaces Elements can be defined in different namespaces Namespaces look like URLs You can use xmlns to declare a default namespace <newsItemxmlns='http://iptc.org/std/nar/2006-10-01/'>   <itemMeta>   <title>Pope Blesses Astronauts</title> </itemMeta></newsItem> newsItemis in the http://iptc.org/std/nar/2006-10-01/namespace itemMeta and title are also in the http://iptc.org/std/nar/2006-10-01/ ns Child elements inherit from their parents
  • 8. XML Namespace Prefixes You can use xmlns:prefix to declare a namespace and bind it to a prefix <nar:newsItemxmlns:nar='http://iptc.org/std/nar/2006-10-01/'>  <nar:itemMeta>   <nar:title>Pope Blesses Astronauts</nar:title> </nar:itemMeta></nar:newsItem> newsItem is in the http://iptc.org/std/nar/2006-10-01/ namespace itemMeta and title are also in the http://iptc.org/std/nar/2006-10-01/ namespace To an XML parser, this document and the previous one are identical
  • 9. XPath Crash CourseThe Basics: Selecting Elements The simplest XPath form: one or more tag names, separated by slashes (/) newsItem/itemMeta/title<- title under itemMeta Use * instead of a tag name to match anything newsItem/*/title <- title grandchildren of newsItem An empty tag searches all levels of the tree //title Every title element in the doc newsItem//title Every title under newsItem
  • 10. XPath: Using Attributes Attribute values are indicated by @ @rel<- The rel attribute of the current element Element and Attribute values are tied by /@ link/@rel<- The rel attribute of the link element Use [] for conditional selections link[@rel] <- link element with a rel attribute link[@rel = “parent”] link[@size &lt; “1000”] link[not(@href)]
  • 11. XPath and Namespaces XPath supports namespaces nitf:p <- The p element from the nitf namespace xhtml:p <- The p element from the xhtml ns nar:* <- Any element from the nar namespace @atom:* <- Any attribute from the atom ns Protip: if you can’t figure out why your XPath expression isn’t matching, check the namespace
  • 12. What Else Can XPath Do?Numeric, String, Boolean Functions Publication/FilingMetadata[1] Publication/FilingMetadata[last()] Publication/FilingMetadata[last() - 1] FilingMetadata[position() mod 2 = 0] FilingMetadata[Category = “q” or Category = “j”] not(contains(SlugLine, “advisory”)) starts-with(FilingOnlineCode, “1”) And XPath 2.0 adds even more functions, including regular expressions
  • 13. More XPath Information List of examples: http://msdn.microsoft.com/en-us/library/ms256086.aspx Introductory, interactive tutorial: http://www.zvon.org/comp/r/tut-XPath_1.html More advanced tutorial: http://www.ibm.com/developerworks/xml/tutorials/x-xpath/section2.html XPath chapter from XML in a Nutshell: http://oreilly.com/catalog/xmlnut/chapter/ch09.html