Home / Interview / Xpath :: General Questions

Interview :: Xpath

11)

What do you mean by XPath operators?

XPath defines operators and functions on nodes. An XPath expression returns either a node-set, a string, a Boolean, or a number.

12)

What are the different types of operators in XPath?

XPath operators can be categorized in different category according to their property. Following are the different types of XPath operators:

  • Comparison Operators
  • Boolean Operators
  • Number Functions/Operators
  • String Functions
  • Node Functions/Operators

13) What do you understand by XPath comparison operator?

XPath comparison operator is used to compare one value to another. There are different type of comparison operators:

  • =
  • !=
  • <
  • >
  • <=
  • >=
14)

What do you mean by Xpath Boolean operatos?

Boolean operators are simple words AND, OR, NOT etc. used to combine or exclude keywords. They connect your search words together to either concise or expand your set of results.

15)

What do you understand by XPath number operators?

The XPath number operators are used to do mathematical operations on different keywords. There are five number operators in XPath.

  • +
  • -
  • *
  • div
  • mode

16)

What do you understand by XPath number functions?

In XPath, number functions are used to fetch the different type of values from the expressions. For example, ceiling value, floor value etc.

There are four types of number functions in XPath:

  • ceiling()
  • floor()
  • round()
  • sum()

17)

What do you know by XPath string functions?

The XPath string functions specify some rules which are used to get strings according to your preferences.

18) How to define relationship among nodes?

There are following types of nodes in XPath. These nodes are related to each other to form a tree like structure. These nodes are:

  • Parents
  • Children
  • Siblings
  • Ancestors
  • Descendents

For example:

19) What are the different standard functions in XPath?

XPath has more than 101 build-in functions. These built-in functions are used in Boolean values, string values, numeric values, date and time comparison, sequence manipulation etc.

20) What are the different XPath Axes?

XPath axes are used to set relation of current node with another node. A list of XPath axes to set relation with other nodes are:

  • ancestor: It is used to get all ancestor (parent, grandparent etc) of current node.
  • ancestor-or-self: It is used to get all ancestors (parent, grandparent, etc.) of the current node and also the current node.
  • attribute: It is used to get all attributes of the current node.
  • child : It is used to retrieve all children of the current node.
  • descendant: It is used to get all descendants (children, grandchildren, etc.) of the current node.
  • namespace: It is used to get all namespace nodes of the current node.
  • preceding: It is used to get everything in the document that is comes before the start tag of the current node.