What is Xpath?- A language for addressing specific parts of an XML document is known as an XPath. - XPath is just like the Document Object Model (DOM), it models an XML document as a tree of nodes. - A mechanism for navigating through and selecting nodes from the XML document is an XPath expression. - This expression is, in a way, analogous to an SQL query which is used to select records from a database. - Different types of nodes are included like element nodes, attribute nodes and text nodes. - A string-value can be computed for each type of node is defined by the Xpath. - A set of library standard functions for working with strings, numbers and boolean expressions are defined.
1. child::* - It selects all children of the root node. 2. .//name - It selects all elements having the name "name", descendants of the current node. 3. /catalog/cd[price>20.50] – It selects all the cd elements that have a price element with a value larger than 20.50.
|