1.

What is predicate in XPath?

Answer»

Predicate are used to find specific node or a node containing specific value and are defined using [...] .

ExpressionResult
/class/student[1]Selects the first student element that is the child of the class element.
/class/student[last()]Selects the last student element that is the child of the class element.
/class/student[last()-1]Selects the last but one student element that is the child of the class element.
//student[rollno='493']Selects all the student elements that have an attribute named rollno with a value of '493'


Discussion

No Comment Found