XPath Interview Questions & Answers

5 avg. rating (100% score) - 5879 votes

XPath Interview Questions & Answers

Searching for Xpath interview questions? Looking for the suitable job opportunity on Xpath? Not able to find suitable interview questions on related skill? XPath is a programing language used for selecting nodes across XML document. However, Path is also used to calculate the values from the content of an XML document. XPath was originally defined by the World Wide Web Consortium. Go through wisdom jobs Xpath job interview questions and answers to get shortlisted for the interview questions asked in various interviews. Many companies are looking to hire Xpath professionals for the competitive roles. There is given XPath interview and answers that have been asked in numerous organizations. Following are the list of best XPath job interview questions and answers framed on wisdom jobs page.

XPath Interview Questions

XPath Interview Questions
    1. Question 1. What Is Xpath?

      Answer :

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

    2. Question 2. What Are The Main Features Of Xpath?

      Answer :

      • 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. Question 3. What Do You Mean By Xpath Expressions?

      Answer :

      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. Question 4. What Do You Mean By Xpath Nodes?

      Answer :

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

    5. Question 5. How Many Types Of Nodes In Xpath?

      Answer :

      There are seven kinds of nodes in XPath:

      • Element
      • Attribute
      • Text
      • Namespace
      • Processing-instruction
      • Comment
      • Document nodes

    6. Question 6. What Is Xpath Syntax?

      Answer :

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

    7. Question 7. What Are The Different Types Of Location Paths In Xpath?

      Answer :

      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. Question 8. What Is The Meaning Of Absolute Path In Xpath?

      Answer :

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

      For Example:

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

    9. Question 9. What Do You Mean By Xpath Relative Path?

      Answer :

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

    10. Question 10. What Do You Mean By Xpath Axes?

      Answer :

      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.

    11. Question 11. What Do You Mean By Xpath Operators?

      Answer :

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

    12. Question 12. What Are The Different Types Of Operators In Xpath?

      Answer :

      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. Question 13. What Do You Understand By Xpath Comparison Operator?

      Answer :

      XPath comparison operator is used to compare one value to another.

      There are different type of comparison operators:

      • =
      • !=
      • <
      • >
      • <=
      • >=

    14. Question 14. What Do You Mean By Xpath Boolean Operatos?

      Answer :

      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. Question 15. What Do You Understand By Xpath Number Operators?

      Answer :

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

      There are five number operators in XPath:

      1. +
      2. -
      3. *
      4. div
      5. mod

    16. Question 16. What Do You Understand By Xpath Number Functions?

      Answer :

      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. Question 17. What Do You Know By Xpath String Functions?

      Answer :

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

    18. Question 18. How To Define Relationship Among Nodes?

      Answer :

      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:

      <book>  
        <title>Parallel Algorithm</title>  
        <author>Rashmi Sharma</author>  
        <year>2008</year>  
        <price>150.00</price>  
      </book>

    19. Question 19. What Are The Different Standard Functions In Xpath?

      Answer :

      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. Question 20. What Are The Different Xpath Axes?

      Answer :

      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.

    21. Question 21. What Is An Atomic Value In Xpath?

      Answer :

      Nodes that has no parent node or child node are called as Atomic values.

      For example:

      <book>  
        <title>Parallel Algorithm</title>  
        <author>Rashmi Sharma</author>  
        <year>2008</year>  
        <price>150.00</price>  
      </book>

    22. Question 22. What Happens About The Presence Of The Top-level Element In Xslt?

      Answer :

      1. The top-level elements don't have any effect on the behaviour of XSLT elements.
      2. The functions that are defined with it also don't have any affect in the document.
      3. The top-level elements are not permitted to be used by specifying the xsl:apply templates.
      4. XSLT process is provided to ignore the top-level elements and ignore some of it if an error occurs.
      5. XSLT top-element element doesn't recognize the namespace URI and can be provided using other sources.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

XPath Tutorial