Bug in XPath 2.0 regular expression search
Posted: Fri Jul 29, 2005 3:57 am
Consider this XML document:
I want to match the text node containing ASCII 'A' using an XPath 2.0 expression in the oXygen 6.1 XPath search box. This works:
but this returns 0 results:
even though it is semantically identical according to XPath 2 / XML schema regular expression rules.
Instead, the second search in oXygen matches this:
i.e. a string with an ampersand character reference followed by literal "#65;". It seems that oXygen is not correctly parsing the character reference before doing the regular expression match.
I don't know if oXygen passes an XPath 2.0 search to the Saxon 8 engine, but if so, the problem is not with Saxon 8, because it performs correctly given this XQuery using the same matches() call:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<test>
<string>A dog</string>
<string>a cat</string>
</test>
Code: Select all
//text()[matches(., "A")]
Code: Select all
//text()[matches(., "A")]
Instead, the second search in oXygen matches this:
Code: Select all
<string>A frog</string>
I don't know if oXygen passes an XPath 2.0 search to the Saxon 8 engine, but if so, the problem is not with Saxon 8, because it performs correctly given this XQuery using the same matches() call:
Code: Select all
let $xml :=
<test>
<string>A dog</string>
<string>a cat</string>
</test>
for $n in $xml//string[matches(., "A")]
return $n
(: returns <string>A dog</string> :)