SlideShare a Scribd company logo
Presentation on XPATH
© Sun Technologies Inc. 1
WHAT IS XPATH ?
•XPath is normally called as XML Path
•XPath is the one of the way to locate elements on
webpage.
•XPath uses path expressions to select element in an
HTML document.
•XPath contains a library of standard functions
© Sun Technologies Inc. 2
XPath Syntax
• XPath uses path expressions to select nodes in an XML document.
The node is selected by following steps.
© Sun Technologies Inc. 3
Expression Description
nodename Selects all nodes with the name "nodename"
/ Selects from the root node
// Selects nodes in the document from the current node that
match the selection no matter where they are
. Selects the current node
.. Selects the parent of the current node
@ Selects attributes
Xpath Ways
• Xpath can be created in two ways:
• Absolute Xpath
Absolute Xpath begins with a root path and is prefixed with a “/”.
• Relative Xpath
Relative Xpath begins from the current location and is prefixed with
a “//”.
© Sun Technologies Inc. 4
XPath Axes
An axis defines a node-set relative to the current node.
© Sun Technologies Inc. 5
•ancestor
•ancestor-or-self
•attribute
•child
•descendant
•descendant-or-self
•following
•following-sibling
•namespace
•parent
•preceding
•preceding-sibling
•self
Selecting Unknown Nodes
• XPath wildcards can be used to select unknown XML nodes.
© Sun Technologies Inc. 6
Wildcard Description
* Matches any element node
@* Matches any attribute node
node() Matches any node of any kind
XPath functions
XPath contains a number of functions on node sets, numbers, and strings;
here are a few of them:
• Contains: contains(arg1, arg2) tests if arg1 contains arg2
Example://img[contains(@src,’Profile’)]
• starts-with: starts-with(arg1, arg2) tests if arg1 starts with arg2
Example: //*[starts-with(name(), 'sec']
• ends-with: ends-with(arg1, arg2) tests if arg1 ends with arg2
Example: //*[ends-with(name(), ‘details']
© Sun Technologies Inc. 7

More Related Content

What's hot

Xml query language and navigation
Xml query language and navigationXml query language and navigation
Xml query language and navigation
Raghu nath
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
yht4ever
 

What's hot (20)

XML
XMLXML
XML
 
Xml Schema
Xml SchemaXml Schema
Xml Schema
 
Xml query language and navigation
Xml query language and navigationXml query language and navigation
Xml query language and navigation
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
Java logging
Java loggingJava logging
Java logging
 
DTD
DTDDTD
DTD
 
XSLT
XSLTXSLT
XSLT
 
JDBC
JDBCJDBC
JDBC
 
CSS media types
CSS media typesCSS media types
CSS media types
 
JAVASCRIPT PPT [Autosaved].pptx
JAVASCRIPT PPT [Autosaved].pptxJAVASCRIPT PPT [Autosaved].pptx
JAVASCRIPT PPT [Autosaved].pptx
 
02 well formed and valid documents
02 well formed and valid documents02 well formed and valid documents
02 well formed and valid documents
 
Introduction to html 5
Introduction to html 5Introduction to html 5
Introduction to html 5
 
Java and XML
Java and XMLJava and XML
Java and XML
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Tomcat server
 Tomcat server Tomcat server
Tomcat server
 
Javascript functions
Javascript functionsJavascript functions
Javascript functions
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Object Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScript
 

Viewers also liked

Viewers also liked (20)

Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Jmeter
JmeterJmeter
Jmeter
 
Maven and ANT
Maven and ANTMaven and ANT
Maven and ANT
 
Path Testing
Path TestingPath Testing
Path Testing
 
Selenium
SeleniumSelenium
Selenium
 
Jira
JiraJira
Jira
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1
 
Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
Selenium
SeleniumSelenium
Selenium
 
Software testing
Software testingSoftware testing
Software testing
 
Javascript
JavascriptJavascript
Javascript
 
Mobile Application Testing
Mobile Application TestingMobile Application Testing
Mobile Application Testing
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
 
HTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts BasicsHTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts Basics
 
Introduction
IntroductionIntroduction
Introduction
 
XMPP - Introduction And LAS Implementation (Presentation)
XMPP - Introduction And LAS  Implementation (Presentation)XMPP - Introduction And LAS  Implementation (Presentation)
XMPP - Introduction And LAS Implementation (Presentation)
 
XML
XMLXML
XML
 
Severity и Priority для неначинающих: очевидное и невероятное
Severity и Priority для неначинающих: очевидное и невероятноеSeverity и Priority для неначинающих: очевидное и невероятное
Severity и Priority для неначинающих: очевидное и невероятное
 

Similar to XPATH

Similar to XPATH (20)

X FILES
X FILESX FILES
X FILES
 
Day2 xslt x_path_xquery
Day2 xslt x_path_xqueryDay2 xslt x_path_xquery
Day2 xslt x_path_xquery
 
Xpath.pdf
Xpath.pdfXpath.pdf
Xpath.pdf
 
Xpath
XpathXpath
Xpath
 
XML Technologies
XML TechnologiesXML Technologies
XML Technologies
 
26xslt
26xslt26xslt
26xslt
 
02_Xpath.pdf
02_Xpath.pdf02_Xpath.pdf
02_Xpath.pdf
 
Session 4
Session 4Session 4
Session 4
 
03 x files
03 x files03 x files
03 x files
 
Implementing a Distributed Hash Table with Scala and Akka
Implementing a Distributed Hash Table with Scala and AkkaImplementing a Distributed Hash Table with Scala and Akka
Implementing a Distributed Hash Table with Scala and Akka
 
Attack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaAttack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and Kibana
 
Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5
 
XML Pipelines
XML PipelinesXML Pipelines
XML Pipelines
 
X path
X pathX path
X path
 
X path
X pathX path
X path
 
Scrapy.for.dummies
Scrapy.for.dummiesScrapy.for.dummies
Scrapy.for.dummies
 
XML(EXtensible Markup Language). XML(EXtensible Markup Language).pptppt
XML(EXtensible Markup Language). XML(EXtensible Markup Language).pptpptXML(EXtensible Markup Language). XML(EXtensible Markup Language).pptppt
XML(EXtensible Markup Language). XML(EXtensible Markup Language).pptppt
 
Xml
XmlXml
Xml
 
Selenium-Locators
Selenium-LocatorsSelenium-Locators
Selenium-Locators
 
Structured Strategy: How to Supercharge Your Content Analysis with XML and XPath
Structured Strategy: How to Supercharge Your Content Analysis with XML and XPathStructured Strategy: How to Supercharge Your Content Analysis with XML and XPath
Structured Strategy: How to Supercharge Your Content Analysis with XML and XPath
 

More from Sun Technlogies (9)

HyperText Markup Language - HTML
HyperText Markup Language - HTMLHyperText Markup Language - HTML
HyperText Markup Language - HTML
 
Extended Finite State Machine - EFSM
Extended Finite State Machine - EFSMExtended Finite State Machine - EFSM
Extended Finite State Machine - EFSM
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
 
Core java
Core javaCore java
Core java
 
Automation Testing
Automation TestingAutomation Testing
Automation Testing
 
Devops
DevopsDevops
Devops
 
QTest
QTest QTest
QTest
 
Array and functions
Array and functionsArray and functions
Array and functions
 
Sikuli
SikuliSikuli
Sikuli
 

Recently uploaded

Recently uploaded (20)

Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
How To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdfHow To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdf
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 
Benefits of Employee Monitoring Software
Benefits of  Employee Monitoring SoftwareBenefits of  Employee Monitoring Software
Benefits of Employee Monitoring Software
 

XPATH

  • 1. Presentation on XPATH © Sun Technologies Inc. 1
  • 2. WHAT IS XPATH ? •XPath is normally called as XML Path •XPath is the one of the way to locate elements on webpage. •XPath uses path expressions to select element in an HTML document. •XPath contains a library of standard functions © Sun Technologies Inc. 2
  • 3. XPath Syntax • XPath uses path expressions to select nodes in an XML document. The node is selected by following steps. © Sun Technologies Inc. 3 Expression Description nodename Selects all nodes with the name "nodename" / Selects from the root node // Selects nodes in the document from the current node that match the selection no matter where they are . Selects the current node .. Selects the parent of the current node @ Selects attributes
  • 4. Xpath Ways • Xpath can be created in two ways: • Absolute Xpath Absolute Xpath begins with a root path and is prefixed with a “/”. • Relative Xpath Relative Xpath begins from the current location and is prefixed with a “//”. © Sun Technologies Inc. 4
  • 5. XPath Axes An axis defines a node-set relative to the current node. © Sun Technologies Inc. 5 •ancestor •ancestor-or-self •attribute •child •descendant •descendant-or-self •following •following-sibling •namespace •parent •preceding •preceding-sibling •self
  • 6. Selecting Unknown Nodes • XPath wildcards can be used to select unknown XML nodes. © Sun Technologies Inc. 6 Wildcard Description * Matches any element node @* Matches any attribute node node() Matches any node of any kind
  • 7. XPath functions XPath contains a number of functions on node sets, numbers, and strings; here are a few of them: • Contains: contains(arg1, arg2) tests if arg1 contains arg2 Example://img[contains(@src,’Profile’)] • starts-with: starts-with(arg1, arg2) tests if arg1 starts with arg2 Example: //*[starts-with(name(), 'sec'] • ends-with: ends-with(arg1, arg2) tests if arg1 ends with arg2 Example: //*[ends-with(name(), ‘details'] © Sun Technologies Inc. 7