Questions tagged [descendant-or-self]
3 questions
5
votes
2 answers
XQuery: // vs descendant-or-self::node()
Recently I needed to evaluate an XQuery on the Node of an HTML document. Basically, I needed to select all elements with an href attribute from the first child of the body element. I've added a slight example to explain:

RDM
- 4,986
- 4
- 34
- 43
4
votes
2 answers
Weird behaviour of Java XPath resolver for documents with namespaces
I need to query XML documents using XPath expressions in a Java application. I have created the following class, which accepts a file (location of the XML document on a local hard drive) and an XPath query, and should return the result of evaluating…

Dušan Rychnovský
- 11,699
- 8
- 41
- 65
3
votes
3 answers
xpath descendant and descendant-or-self work completely different
I try to find all seconds tds among the descendants of div with the specified id, i.e. 22 and 222. The first solution that comes to my mind was:
//div[@id='indicator']//td[2]
but it selects only the first table cell, i.e. 22 but not both 22 and…

Anton Kolokolcev
- 31
- 3