From: Daniel Lehman dlehman25@gmail.com
--- dlls/msxml3/element.c | 13 +++++++++---- dlls/msxml3/tests/domdoc.c | 6 ++++-- dlls/msxml4/tests/domdoc.c | 7 +++++-- dlls/msxml6/tests/domdoc.c | 6 ++++-- 4 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c index 302849aced6..d2a14fdabcd 100644 --- a/dlls/msxml3/element.c +++ b/dlls/msxml3/element.c @@ -1827,11 +1827,16 @@ static HRESULT domelem_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode * if (attrIndex < index) return S_FALSE;
- xmlns = xmlNewNs(NULL, BAD_CAST "http://www.w3.org/2000/xmlns/", BAD_CAST "xmlns"); - if (!xmlns) - return E_OUTOFMEMORY; + if (!ns->prefix) { + xmlns = NULL; + curr = xmlNewProp(NULL, BAD_CAST "xmlns", ns->href); + } else { + xmlns = xmlNewNs(NULL, BAD_CAST "http://www.w3.org/2000/xmlns/", BAD_CAST "xmlns"); + if (!xmlns) + return E_OUTOFMEMORY;
- curr = xmlNewNsProp(NULL, xmlns, ns->prefix, ns->href); + curr = xmlNewNsProp(NULL, xmlns, ns->prefix, ns->href); + } if (!curr) { xmlFreeNs(xmlns); return E_OUTOFMEMORY; diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index d9dfa1d1be6..23a114db713 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -13773,9 +13773,7 @@ static void test_namespaces_as_attributes(void) { item = NULL; hr = IXMLDOMNamedNodeMap_get_item(map, i, &item); - todo_wine_if(test->todo) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (hr != S_OK) continue;
str = NULL; hr = IXMLDOMNode_get_nodeName(item, &str); @@ -13787,8 +13785,10 @@ static void test_namespaces_as_attributes(void) hr = IXMLDOMNode_get_prefix(item, &str); if (test->prefixes[i]) { + todo_wine_if(test->todo) { ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(!lstrcmpW(str, _bstr_(test->prefixes[i])), "got %s\n", wine_dbgstr_w(str)); + } SysFreeString(str); } else @@ -13797,6 +13797,7 @@ static void test_namespaces_as_attributes(void) str = NULL; hr = IXMLDOMNode_get_baseName(item, &str); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine_if(test->todo) ok(!lstrcmpW(str, _bstr_(test->basenames[i])), "got %s\n", wine_dbgstr_w(str)); SysFreeString(str);
@@ -13804,6 +13805,7 @@ static void test_namespaces_as_attributes(void) hr = IXMLDOMNode_get_namespaceURI(item, &str); if (test->uris[i]) { + todo_wine_if(test->todo) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); if (test->prefixes[i] && !strcmp(test->prefixes[i], "xmlns")) ok(!SysStringLen(str), "got %s\n", wine_dbgstr_w(str)); diff --git a/dlls/msxml4/tests/domdoc.c b/dlls/msxml4/tests/domdoc.c index d294732283f..67f37b6966b 100644 --- a/dlls/msxml4/tests/domdoc.c +++ b/dlls/msxml4/tests/domdoc.c @@ -256,9 +256,7 @@ static void test_namespaces_as_attributes(void) { item = NULL; hr = IXMLDOMNamedNodeMap_get_item(map, i, &item); - todo_wine_if(test->todo) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (hr != S_OK) continue;
str = NULL; hr = IXMLDOMNode_get_nodeName(item, &str); @@ -271,9 +269,11 @@ static void test_namespaces_as_attributes(void) if (test->prefixes[i]) { /* MSXML4 can report different results with different service packs */ + todo_wine_if(test->todo) { ok(hr == S_OK || broken(hr == S_FALSE), "Unexpected hr %#lx.\n", hr); ok(!lstrcmpW(str, test->prefixes[i]) || broken(!str), "got %s\n", wine_dbgstr_w(str)); + } SysFreeString(str); } else @@ -283,6 +283,7 @@ static void test_namespaces_as_attributes(void) hr = IXMLDOMNode_get_baseName(item, &str); /* MSXML4 can report different results with different service packs */ ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine_if(test->todo) ok(!lstrcmpW(str, test->basenames[i]) || broken(!lstrcmpW(str, L"xmlns")), "got %s\n", wine_dbgstr_w(str)); SysFreeString(str); @@ -291,11 +292,13 @@ static void test_namespaces_as_attributes(void) hr = IXMLDOMNode_get_namespaceURI(item, &str); if (test->uris[i]) { + todo_wine_if(test->todo) { ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); if (test->prefixes[i] && !lstrcmpW(test->prefixes[i], L"xmlns")) ok(!lstrcmpW(str, L""), "got %s\n", wine_dbgstr_w(str)); else ok(!lstrcmpW(str, test->uris[i]), "got %s\n", wine_dbgstr_w(str)); + } SysFreeString(str); } else diff --git a/dlls/msxml6/tests/domdoc.c b/dlls/msxml6/tests/domdoc.c index 1eabe97dd79..9283379731d 100644 --- a/dlls/msxml6/tests/domdoc.c +++ b/dlls/msxml6/tests/domdoc.c @@ -263,9 +263,7 @@ static void test_namespaces_as_attributes(void) { item = NULL; hr = IXMLDOMNamedNodeMap_get_item(map, i, &item); - todo_wine_if(test->todo) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (hr != S_OK) continue;
str = NULL; hr = IXMLDOMNode_get_nodeName(item, &str); @@ -277,8 +275,10 @@ static void test_namespaces_as_attributes(void) hr = IXMLDOMNode_get_prefix(item, &str); if (test->prefixes[i]) { + todo_wine_if(test->todo) { ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(!lstrcmpW(str, test->prefixes[i]), "got %s\n", wine_dbgstr_w(str)); + } SysFreeString(str); } else @@ -294,12 +294,14 @@ static void test_namespaces_as_attributes(void) hr = IXMLDOMNode_get_namespaceURI(item, &str); if (test->uris[i]) { + todo_wine_if(test->todo) { ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); if (test->prefixes[i] && !lstrcmpW(test->prefixes[i], L"xmlns")) ok(!lstrcmpW(str, L"http://www.w3.org/2000/xmlns/"), "got %s\n", wine_dbgstr_w(str)); else ok(!lstrcmpW(str, test->uris[i]), "got %s\n", wine_dbgstr_w(str)); + } SysFreeString(str); } else