0% found this document useful (0 votes)
27 views8 pages

Unit 2

The document provides an overview of XPath, a query language for selecting nodes in XML documents, detailing its basics, types, and syntax. It distinguishes between Absolute XPath, which navigates from the root element, and Relative XPath, which starts from any point based on search criteria. Key components of XML nodes, including root, element, attribute, and text nodes, are also discussed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views8 pages

Unit 2

The document provides an overview of XPath, a query language for selecting nodes in XML documents, detailing its basics, types, and syntax. It distinguishes between Absolute XPath, which navigates from the root element, and Relative XPath, which starts from any point based on search criteria. Key components of XML nodes, including root, element, attribute, and text nodes, are also discussed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 8

Web Data Management

Prof. C Sheeja Justin, Assistant Professor


IT & Computer Science
Unit 2-Xpaths
XPath Basics
Types of Xpaths
XPath steps and expressions
<bookstore> //open xpath online realtime tester
<book category="cooking">
<title lang="eng">Everyday routine </title>
<author>smith </author>
<year>2022</year>
<price>30.00</price>
</book>
<book category="children">
<title lang="eng">Harry Potter</title>
<author>jk.Rowling</author>
<year>2024</year>
<price>30.00</price>
XPath (XML Path Language)
XPath is a query language for selecting nodes in an XML
document.
It provides a way to navigate and extract information from XML
documents.
XPath Types
1.Absolute Xpath
2.Relative Xpath
Absolute Xpath:traversing or navigating from root element of the
document to child element of the document with the help of single
forward slash
Means coming down Step by step or one by one
This makes your Xpath performance is very slow
Syntax:/tagname
Eg)/bookstore/book[2]/author
2.Relative Xpath
Starts from any point in the document based on the search criteria with the
help of double forward slashes
Means directly come to the particular node or element.
Ex)//tagname[@attribute name=‘attribute value’]
//*/article/keywords
Key Components
1.Nodes in XML:
Root Node: The topmost element.
Element Node: Tags in the XML.
Attribute Node: Attributes of elements.
Text Node: Text within an element.

2.XPath types Syntax:


Absolute Path: Starts from the root (e.g., /root/child).
Relative Path: Starts from the current node (e.g., .//*/child).

You might also like