Reputation: 37
My sample xml:
<root>
<test>
<para>This is a <comment>new</comment> para</para>
</test>
</root>
My XPath will be:
root/test/para[text()=contains(., 'This is a new para')];
It will work fine as it contains the same text value.
If the text content in the xml is changed at the end.
<root>
<test>
<para>This is a <comment>new</comment> para hightlighted</para>
</test>
</root>
It should return false. Instead I am getting true. Please help. Thanks in advance.
Upvotes: 0
Views: 1104
Reputation: 116992
Given:
<root>
<test>
<para id="1">This is a <comment>new</comment> para</para>
<para id="2">This is a <comment>new</comment> para hightlighted</para>
</test>
</root>
this XPath expression:
root/test/para[. = 'This is a new para']
matches para id="1"
but not para id="2"
.
Upvotes: 2