The basic loop correctly finds the first element, however the second element repeats the first node, since it was incremented and the ns->next was skipped over.
From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
The basic loop correctly finds the first element, however the second element repeats the first node, since it was incremented and the ns->next was skipped over. --- dlls/msxml3/element.c | 1 - dlls/msxml3/tests/domdoc.c | 63 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c index 394a4b28201..2fa439a0e5a 100644 --- a/dlls/msxml3/element.c +++ b/dlls/msxml3/element.c @@ -1819,7 +1819,6 @@ static HRESULT domelem_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode * if (!node->nsDef) return S_FALSE;
- attrIndex++; ns = node->nsDef; for (; attrIndex < index && ns->next != NULL; attrIndex++) ns = ns->next; diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 81f1235cd9b..e497fabbae0 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -14207,6 +14207,68 @@ static void test_indent(void) SysFreeString(str); }
+static void test_document_namespaces(void) +{ + const char *namespaces[] = + { + "xmlns:oslc_am", + "xmlns:rdf", + "xmlns:dcterms", + "xmlns:foaf", + }; + IXMLDOMDocument *doc; + IXMLDOMElement *nodeRoot; + VARIANT_BOOL b; + HRESULT hr; + IXMLDOMNamedNodeMap *map; + LONG len, i; + BSTR nodename, str; + + str = SysAllocString(L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + L"<rdf:RDF xmlns:oslc_am="http://open-services.net/ns/am#%5C"" + L" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#%5C"" + L" xmlns:dcterms="http://purl.org/dc/terms/%5C"" + L" xmlns:foaf="http://xmlns.com/foaf/0.1/%5C" >" + L"</rdf:RDF>"); + + doc = create_document(&IID_IXMLDOMDocument2); + + hr = IXMLDOMDocument_loadXML(doc, str, &b); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(b == VARIANT_TRUE, "got %d\n", b); + + hr = IXMLDOMDocument_get_documentElement(doc, &nodeRoot); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IXMLDOMElement_get_attributes(nodeRoot, &map); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + len = -1; + hr = IXMLDOMNamedNodeMap_get_length(map, &len); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(len == 4, "len %#lx.\n", len); + + for(i=0; i < len; i++) + { + IXMLDOMNode *pr_node = NULL; + + hr = IXMLDOMNamedNodeMap_get_item(map, i, &pr_node); + ok( hr == S_OK, "Unexpected hr %#lx (%ld).\n", hr, i); + + hr = IXMLDOMNode_get_nodeName(pr_node, &nodename); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!lstrcmpW(nodename, _bstr_(namespaces[i])), "got %s\n", wine_dbgstr_w(nodename)); + SysFreeString(nodename); + } + + IXMLDOMNamedNodeMap_Release(map); + IXMLDOMElement_Release(nodeRoot); + + IXMLDOMDocument_Release(doc); + + free_bstrs(); +} + static DWORD WINAPI new_thread(void *arg) { HRESULT hr = CoInitialize(NULL); @@ -14261,6 +14323,7 @@ START_TEST(domdoc) test_testTransforms(); test_namespaces_basic(); test_namespaces_change(); + test_document_namespaces(); test_FormattingXML(); test_nodeTypedValue(); test_TransformWithLoadingLocalFile();
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150329
Your paranoid android.
=== debian11 (32 bit report) ===
Report validation errors: msxml3:domdoc crashed (c0000005)
=== debian11 (32 bit ar:MA report) ===
Report validation errors: msxml3:domdoc crashed (c0000005)
=== debian11 (32 bit de report) ===
Report validation errors: msxml3:domdoc crashed (c0000005)
=== debian11 (32 bit fr report) ===
Report validation errors: msxml3:domdoc crashed (c0000005)
=== debian11 (32 bit he:IL report) ===
Report validation errors: msxml3:domdoc crashed (c0000005)
=== debian11 (32 bit hi:IN report) ===
Report validation errors: msxml3:domdoc crashed (c0000005)
=== debian11 (32 bit ja:JP report) ===
Report validation errors: msxml3:domdoc crashed (c0000005)
=== debian11 (32 bit zh:CN report) ===
Report validation errors: msxml3:domdoc crashed (c0000005)
=== debian11b (32 bit WoW report) ===
Report validation errors: msxml3:domdoc crashed (c0000005)
=== debian11b (64 bit WoW report) ===
msxml4: domdoc.c:257: Test failed: Unexpected hr 0x1.
msxml6: domdoc.c:260: Test failed: Unexpected hr 0x1.
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 00000000007F00FA, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032 win.c:4070: Test failed: Expected active window 0000000002DB0166, got 0000000000000000. win.c:4071: Test failed: Expected focus window 0000000002DB0166, got 0000000000000000.
Report validation errors: msxml3:domdoc crashed (c0000005) msxml4:domdoc crashed (c0000005) msxml6:domdoc crashed (c0000005)