I have a small problem with Xpath contains with dom4j ...
Lets say my XML is
<Home>
<Addr>
<Street>ABC</Street>
<Number>5</Number>
<Comment>BLAH BLAH BLAH <br/><br/>ABC</Comment>
</Addr>
</Home>
Lets say I want to find all the nodes that have ABC in the text given the root Element...
So the xpath that i would needed to write would be
//*[contains(text(),'ABC')]
However this is not what Dom4j returns .... is this a dom4j problem or my understanding how xpath works. since that query returns only the Street Element and not the Comment element.
The DOM makes the Comment element a composite element with four tags two
[Text = 'XYZ'][BR][BR][Text = 'ABC']
I would assume that the query should still return the element since it should find the element and run contains on it but it doesn't ... ...
the following query returns the element but it returns far more then just the element, it returns the parent elements as well ... which is undesirable to the problem ...
//*[contains(text(),'ABC')]
Does any one know the xpath query that would return just the Elements <Street/>
and <Comment/>
?