msxml3/tests: add additional conformance tests that show incorrect xpath behavior in wine

John Chadwick johnwchadwick at gmail.com
Thu Jun 27 02:46:38 CDT 2013


After doing some testing, I have spotted some discrepancies in the way
MSXML handles XPath expressions in Wine vs. Windows. In separate
testing, it appears that these behaviors do not vary between versions
of MSXML, so I didn't bother adding tests for multiple versions of
MSXML.

The first issue relates to order. libxml2's xmlXPathEvalExpression
returns an xmlNodeSet, which has no particular order, and presumably
is not live. However, MSXML's selectNodes method returns a standard
DOMNodeList, which is both live and document-ordered, regardless of
the order of the result of the XPath expression. This patch checks to
make sure that reverse axes return in document-order. Since Wine does
not do this (yet,) this test is marked todo.

The second issue relates to operator precedence. For some reason,
Wine's XPath implementation does not appear to be respecting operator
precedence. In section 2.5 of the w3c XPath standard:
--
NOTE: The location path //para[1] does not mean the same as the
location path /descendant::para[1]. The latter selects the first
descendant para element; the former selects all descendant para
elements that are the first para children of their parents.
--
Despite this, Wine currently treats both of those expressions the
same. A test was written, marked todo, displaying this discrepancy.

(This is my first patch. I have tried to be thorough, but please go
easy on me if I did something wrong.)

John.
-------------- next part --------------
From 1691242e7526e400e621c8c592f9afcea69ff9b0 Mon Sep 17 00:00:00 2001
From: John Chadwick <johnwchadwick at gmail.com>
Date: Thu, 27 Jun 2013 03:15:13 -0400
Subject: msxml3/tests: add additional conformance tests that show incorrect
 xpath behaviors in wine.

---
 dlls/msxml3/tests/domdoc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 20b9609..7629c5a 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -1029,6 +1029,7 @@ static char *list_to_string(IXMLDOMNodeList *list)
 
 #define expect_node(node, expstr) { char str[4096]; node_to_string(node, str); ok(strcmp(str, expstr)==0, "Invalid node: %s, expected %s\n", str, expstr); }
 #define expect_list_and_release(list, expstr) { char *str = list_to_string(list); ok(strcmp(str, expstr)==0, "Invalid node list: %s, expected %s\n", str, expstr); if (list) IXMLDOMNodeList_Release(list); }
+#define todo_expect_list_and_release(list, expstr) { char *str = list_to_string(list); todo_wine ok(strcmp(str, expstr)==0, "Invalid node list: %s, expected %s\n", str, expstr); if (list) IXMLDOMNodeList_Release(list); }
 
 struct docload_ret_t {
     VARIANT_BOOL b;
@@ -4434,6 +4435,20 @@ if (0)
     ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("//c[@type]"), &list));
     expect_list_and_release(list, "E3.E2.E2.D1");
 
+    /* msxml's selectNodes returns a document ordered nodelist, regardless of
+     * whether or not the xpath nodelist was document ordered... */
+    ole_check(IXMLDOMNode_selectNodes(rootNode, _bstr_("ancestor-or-self::node()"), &list));
+    todo_expect_list_and_release(list, "D1 E2.D1");
+
+    /* ...but this still works as expected by the xpath standard */
+    ole_check(IXMLDOMNode_selectNodes(rootNode, _bstr_("ancestor-or-self::node()[1]"), &list));
+    expect_list_and_release(list, "E2.D1");
+
+    /* in xpath, [] binds stronger than // - msxml handles this correctly,
+     * but wine does not. libxml2 bug? */
+    ole_check(IXMLDOMNode_selectNodes(rootNode, _bstr_("(//a[1])[last()]"), &list));
+    todo_expect_list_and_release(list, "E1.E4.E2.D1");
+
     ole_check(IXMLDOMNode_selectNodes(rootNode, _bstr_("elem"), &list));
     /* using get_item for query results advances the position */
     ole_check(IXMLDOMNodeList_get_item(list, 1, &node));
-- 
1.8.3.1


More information about the wine-patches mailing list