Home / Interview / Xpath :: General Questions

Interview :: Xpath

1) What is XPath?

XPath is an important and core component of XSLT standard. It is used to traverse the elements and attributes in an XML document.

2) What are the main features of XPath?
  • XPath is a major element in the XSLT standard.
  • It is syntax for defining parts of an XML document.
  • XPATH stands for XML Path Language.
  • It is used for navigating in XML documents.
  • It can be used to query data from XML documents.
  • It uses path expressions to navigate in XML documents.
  • XPATH expressions are case sensitive.
3) What do you mean by XPath expressions?

XPath defines a pattern or path expression to select nodes or node sets in an XML document. These patterns are used by XSLT to perform transformations. XPath specifies seven types of nodes that can be output of the execution of the XPath expression.

  • Root
  • Element
  • Text
  • Attribute
  • Comment
  • Processing Instruction
  • Namespace
4) What do you mean by XPath nodes?

A node is an XML document which is specified in the tree structure.

5) How many types of nodes in XPath?

There are seven kinds of nodes in XPath:

  • Element
  • Attribute
  • Text
  • Namespace
  • Processing-instruction
  • Comment
  • Document nodes
6) What is XPath syntax?

The XPath syntax specifies the different nodes, path expressions, path notation, predicates and URLs which are used to define the XML document.

7) What are the different types of location paths in XPath?

There are two types of location paths used to specify the location of node in XML documents. These paths are absolute or relative path.

8)

What is the meaning of absolute path in XPath?

An absolute path starts with root node or with '/'.

For Example:

/company/employee- It will select employee nodes within class root node.

9)

What do you mean by XPath relative path?

A path is known as relative path if it is started with the node that we've selected.

10)

What do you mean by XPath Axes?

XPath axes are used to identify elements by their relationship like parent, child, sibling, etc. in the same manner like path defines the location of the node.