XPath Presented by Kushan Athukorala. 2 Agenda XPath XPath Terminology Selecting Nodes Predicates.

Slides:



Advertisements
Similar presentations
Dr. Alexandra I. Cristea CS 253: Topics in Database Systems: XPath, NameSpaces.
Advertisements

Dr. Alexandra I. Cristea CS 253: Topics in Database Systems: C2.
Dr. Alexandra I. Cristea XPath and Namespaces.
Managing Data Exchange: XPath
Team 23 Multilingual Online Dictionary 資工碩一 吳全勳 R 資工四 李竺軒 B 電機四 何 偉 B 資工二 王昱蓉 B
XPath XML Path Language. Outline XML Path Language (XPath) Data Model Description Node values XPath expressions Relative expressions Simple subset of.
The learning site: /xpath_syntax.asp xsl/xsl/slides.html.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
XPath Eugenia Fernandez IUPUI. XML Path Language (XPath) a data model for representing an XML document as an abstract node tree a mechanism for addressing.
XML 6.6 XPath 6. What is XPath? XPath is a syntax used for selecting parts of an XML document The way XPath describes paths to elements is similar to.
Multi Platform Applications XML, XPath, XSLT transform.
2-Jun-15 XPath. 2 What is XPath? XPath is a syntax used for selecting parts of an XML document The way XPath describes paths to elements is similar to.
eXtensible Stylesheet Language
XSL Transformations Lecture 8, 07/08/02. Templates The whole element is a template The match pattern determines where this template applies Result element(s)
1 Before The Class What’re the roles of us in this subject? –A researcher –A developer –A problem solver –IT related technologies What’s really confused.
XPath Carissa Mills Jill Kerschbaum. What is XPath? n A language designed to be used by both XSL Transformations (XSLT) and XPointer. n Provides common.
XPath Tao Wan March 04, What is XPath? n A language designed to be used by XSL Transformations (XSLT), Xlink, Xpointer and XML Query. n Primary.
Dr. Alexandra I. Cristea CS 253: Topics in Database Systems: C2.
Manohar – Why XML is Required Problem: We want to save the data and retrieve it further or to transfer over the network. This.
CIS 375—Web App Dev II XPath. 2 XPath IntroductionIntroduction What is XPath? XPath is a syntax for defining parts of an _____ document XPath uses paths.
Overview of XPath Author: Dan McCreary Date: October, 2008 Version: 0.2 with TEI Examples M D.
Introduction to XPath Bun Yue Professor, CS/CIS UHCL.
XP ATH - XML Path Language. W HAT IS XP ATH ? XPath, the XML Path Language, is a query language for selecting nodes from an XML document.query languagenodesXML.
SD2520 Databases using XML and JQuery
Xpath Sources:
Chapter 4 Web Pages Using Web Standards Chapter 3 XML – the ‘X’ in Ajax.
Navigating XML. Overview  Xpath is a non-xml syntax to be used with XSLT and Xpointer. Its purpose according to the W3.org is  to address parts of an.
CSE3201/CSE4500 XPath. 2 XPath A locator for elements or attributes in an XML document. XPath expression gives direction.
TDDD43 XML and RDF Slides based on slides by Lena Strömbäck and Fang Wei-Kleiner 1.
Xpath Xlink Xpointer Xquery Sources:
1/17 ITApplications XML Module Session 7: Introduction to XPath.
Introduction to XPath Web Engineering, SS 2007 Tomáš Pitner.
XML DOCUMENTS & DATABASES. Summary of Introduction to XML HTML vs. XML HTML vs. XML Types of Data Types of Data Basics of XML Basics of XML XML Syntax,
CSE3201/CSE4500 Information Retrieval Systems
XPath XPath is used to navigate through elements and attributes in an XML document. XPath is a major element in W3C's XSLT standard - and XQuery and XPointer.
XSLT and XPath, by Dr. Khalil1 XSL, XSLT and XPath Dr. Awad Khalil Computer Science Department AUC.
1 Dr Alexiei Dingli XML Technologies X-Languages.
1 XPath XPath became a W3C Recommendation 16. November 1999 XPath is a language for finding information in an XML document XPath is used to navigate through.
XPath Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Processing of structured documents Spring 2003, Part 7 Helena Ahonen-Myka.
XPath. Why XPath? Common syntax, semantics for [XSLT] [XPointer][XSLT] [XPointer] Used to address parts of an XML document Provides basic facilities for.
1 Displaying XML Document Web and Database Management System.
August Chapter 6 - XPath & XPointer Learning XML by Erik T. Ray Slides were developed by Jack Davis College of Information Science and Technology.
XPath Aug ’10 – Dec ‘10. XPath   XML Path Language   Technology that allows to select a part or parts of an XML document to process   XPath was.
Advanced Selenium.  XPath is used to navigate through elements and attributes in a document.  XPath includes over 100 built-in functions.  Functions.
XSD Presented by Kushan Athukorala. 2 Agenda XML Namespaces XML Schema XSD Indicators XSD Data Types XSD Schema References.
Advanced Assertions in soapUI Presented by Kushan Athukorala
1 XML Data Management Extracting Data from XML: XPath Werner Nutt based on slides by Sara Cohen, Jerusalem.
1 XML Data Management XPath Principles Werner Nutt.
Submitted To: Ms. Poonam Saini, Asst. Prof., NITTTR Submitted By: Rohit Handa ME (Modular) CSE 2011 Batch.
Lesser Known Injections XML Injections AMol NAik.
XPath. XPath, the XML Path Language, is a query language for selecting nodes from an XML document. The XPath language is based on a tree representation.
More XML XPATH, XSLT CS 431 – February 23, 2005 Carl Lagoze – Cornell University.
Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0http://
IS432 Semi-Structured Data Lecture 4: XPath Dr. Gamal Al-Shorbagy.
CSE3201/CSE4500 XPath. 2 XPath A locator for items in XML document. XPath expression gives direction of navigation.
XPath --XML Path Language Motivation of XPath Data Model and Data Types Node Types Location Steps Functions XPath 2.0 Additional Functionality and its.
Advanced Objects. Agenda 2 Working with Websites & Applications ScriptOnce Helpful XPath Tips.
1 XPath. 2 Agenda XPath Introduction XPath Nodes XPath Syntax XPath Operators XPath Q&A.
1 The XPath Language. 2 XPath Expressions Flexible notation for navigating around trees A basic technology that is widely used uniqueness and scope in.
CITA 330 Section 5 XPath. XSL XSL (Extensible Stylesheet Language) is the standard language for writing stylesheets to transform XML documents among different.
5 Copyright © 2004, Oracle. All rights reserved. Navigating XML Documents by Using XPath.
XML. What is XML? XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to carry data, not to display data.
XML Query languages--XPath. Objectives Understand XPath, and be able to use XPath expressions to find fragments of an XML document Understand tree patterns,
XML and XPath.
{ XML Technologies } BY: DR. M’HAMED MATAOUI
XML Path Language Andy Clark 17 Apr 2002.
XPath 9-May-19.
Xpath October 16, 2019 ICS 541: Xpath.
XPath 7-Dec-19.
Presentation transcript:

XPath Presented by Kushan Athukorala

2 Agenda XPath XPath Terminology Selecting Nodes Predicates

3 XPath XPath is used to navigate through elements and attributes in an XML document XPath is a language for finding information in an XML document XPath is a syntax for defining parts of an XML document XPath uses path expressions to navigate in XML documents XPath contains a library of standard functions XPath is a major element in XSLT XPath is a W3C recommendation

4 XPath Terminology Nodes In XPath, there are seven kinds of nodes 1.Element node 2.Attribute node 3.Text node 4.Namespace node 5.Processing-instruction node 6.Comment node 7.Document node Example – Consider the following XML Harry Potter J K. Rowling (root element node) J K. Rowling (element node) lang="en" (attribute node)

5 XPath Terminology contd. Atomic values Atomic values are nodes with no children or parent Examples J K. Rowling "en" Items Items are atomic values

6 Relationship of Nodes Example Harry Potter J K. Rowling Parent book element is the parent of the title, author, year, and price Children title, author, year, and price elements are all children of the book element Siblings Nodes that have the same parent title, author, year, and price elements are all siblings Ancestors ancestors of the title element are the book element and the bookstore element Descendants descendants of the bookstore element are the book, title, author, year, and price elements

7 Selecting Nodes XPath uses path expressions to select nodes in an XML document ExpressionDescription nodenameSelects all child nodes of the named node /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 attributes

8 Selecting Nodes - Examples Path ExpressionResult bookstoreSelects all the child nodes of the bookstore element /bookstoreSelects the root element bookstoreNote: If the path starts with a slash ( / ) it always represents an absolute path to an element! bookstore/bookSelects all book elements that are children of bookstore //bookSelects all book elements no matter where they are in the document bookstore//bookSelects all book elements that are descendant of the bookstore element, no matter where they are under the bookstore element all attributes that are named lang

9 Predicates Predicates are used to find a specific node or a node that contains a specific value Predicates are always embedded in square brackets Path ExpressionResult /bookstore/book[1]Selects the first book element that is the child of the bookstore element.Note: IE5 and later has implemented that [0] should be the first node, but according to the W3C standard it should have been [1]!! /bookstore/book[last()]Selects the last book element that is the child of the bookstore element /bookstore/book[last()-1]Selects the last but one book element that is the child of the bookstore element /bookstore/book[position()<3]Selects the first two book elements that are children of the bookstore element all the title elements that have an attribute named lang all the title elements that have an attribute named lang with a value of 'eng' /bookstore/book[price>35.00]Selects all the book elements of the bookstore element that have a price element with a value greater than /bookstore/book[price>35.00]/titleSelects all the title elements of the book elements of the bookstore element that have a price element with a value greater than 35.00

10 XPath Wildcards WildcardDescription *Matches any element any attribute node node()Matches any node of any kind Path ExpressionResult /bookstore/*Selects all the child nodes of the bookstore element //*Selects all elements in the document all title elements which have any attribute

11 XPath Axes An axis defines a node-set relative to the current node AxisNameResult ancestorSelects all ancestors (parent, grandparent, etc.) of the current node ancestor-or-selfSelects all ancestors (parent, grandparent, etc.) of the current node and the current node itself attributeSelects all attributes of the current node childSelects all children of the current node descendantSelects all descendants (children, grandchildren, etc.) of the current node descendant-or-selfSelects all descendants (children, grandchildren, etc.) of the current node and the current node itself followingSelects everything in the document after the closing tag of the current node following-siblingSelects all siblings after the current node namespaceSelects all namespace nodes of the current node parentSelects the parent of the current node precedingSelects everything in the document that is before the start tag of the current node preceding-siblingSelects all siblings before the current node selfSelects the current node

12 XPath Axes - Examples ExampleResult child::bookSelects all book nodes that are children of the current node attribute::langSelects the lang attribute of the current node child::*Selects all children of the current node attribute::*Selects all attributes of the current node child::text()Selects all text child nodes of the current node child::node()Selects all child nodes of the current node descendant::bookSelects all book descendants of the current node ancestor::bookSelects all book ancestors of the current node ancestor-or-self::bookSelects all book ancestors of the current node - and the current as well if it is a book node child::*/child::priceSelects all price grandchildren of the current node

13 XPath Operators OperatorDescriptionExampleReturn value |Computes two node-sets//book | //cdReturns a node-set with all book and cd elements +Addition Subtraction *Multiplication6 * 424 divDivision8 div 42 =Equalprice=9.80true if price is 9.80 false if price is 9.90 !=Not equalprice!=9.80true if price is 9.90 false if price is 9.80 <Less thanprice<9.80true if price is 9.00 false if price is 9.80 <=Less than or equal toprice<=9.80true if price is 9.00 false if price is 9.90 >Greater thanprice>9.80true if price is 9.90 false if price is 9.80 >=Greater than or equal toprice>=9.80true if price is 9.90 false if price is 9.70 or price=9.80 or price=9.70true if price is 9.80 false if price is 9.50 and price>9.00 and price<9.90 true if price is 9.80 false if price is 8.50 modModulus (division remainder)5 mod 21

14 XPath Functions Functions Reference Accessor Error and Trace Numeric String AnyURI Boolean Duration/Date/Time QName Node Sequence Context

15 Thank You

16 USA INDIA SRILANKA UK © V I r t u s a C o r p o r a t i o n "Virtusa" is a trademark of the company and a registered trademark in the EU and In India. "Productization" is a service mark of the company and a registered service mark in the United States. "vRule" is a service mark of the company. For more information please contact