Hi Mateusz,
the DOMPrint example specifies the root element as the context node, not
the document node; so the correct behavior is for "bookstore" to return
an empty set, and "." to return the root element.
Alberto
On 1/31/2011 12:14 PM, Mateusz Loskot wrote:
Hi,
Has anything changed between Xerces 3.0 and 3.1 regarding
resolution of XPath expressions?
It may seem strange, but very fundamental expressions like selecting
root element seems to work differently.
A very simple XML sample:
# cat bookstore.xml
<?xml version="1.0" encoding="utf-8"?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
Here is quick test with the DOMPrint utility from Xerces C++ 3.1
# domprint -xpath=/bookstore bookstore.xml
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
# domprint -xpath=bookstore bookstore.xml
#
Correct me if I'm wrong please, but shouldn't the second
command without explicit / anchor select root tree - it is evaluated
against the root anyway, right?
Best regards,