From: Daniel Lehman dlehman25@gmail.com
--- dlls/msxml3/element.c | 13 +++++++++---- dlls/msxml3/tests/domdoc.c | 7 +++++-- dlls/msxml4/tests/domdoc.c | 7 +++++-- dlls/msxml6/tests/domdoc.c | 6 ++++-- 4 files changed, 23 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 6b63a7c1c3d..d6f5e73c852 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -13767,9 +13767,7 @@ static void test_namespaces_as_attributes(void) { item = NULL; hr = IXMLDOMNamedNodeMap_get_item(map, i, &item); - todo_wine_if(test->todo) ok(SUCCEEDED(hr), "Failed to get item, hr %#lx.\n", hr); - if (FAILED(hr)) continue;
str = NULL; hr = IXMLDOMNode_get_nodeName(item, &str); @@ -13781,8 +13779,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, "Failed to get prefix, hr %#lx.\n", hr); ok(!lstrcmpW(str, _bstr_(test->prefixes[i])), "got %s\n", wine_dbgstr_w(str)); + } SysFreeString(str); } else @@ -13791,6 +13791,7 @@ static void test_namespaces_as_attributes(void) str = NULL; hr = IXMLDOMNode_get_baseName(item, &str); ok(SUCCEEDED(hr), "Failed to get base name, 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);
@@ -13798,11 +13799,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, "Failed to get namespace URI, hr %#lx.\n", hr); if (test->prefixes[i] && !strcmp(test->prefixes[i], "xmlns")) ok(!lstrcmpW(str, L""), "got %s\n", wine_dbgstr_w(str)); else ok(!lstrcmpW(str, _bstr_(test->uris[i])), "got %s\n", wine_dbgstr_w(str)); + } SysFreeString(str); } else diff --git a/dlls/msxml4/tests/domdoc.c b/dlls/msxml4/tests/domdoc.c index 93887cc9857..2f02c99c6aa 100644 --- a/dlls/msxml4/tests/domdoc.c +++ b/dlls/msxml4/tests/domdoc.c @@ -259,9 +259,7 @@ static void test_namespaces_as_attributes(void) { item = NULL; hr = IXMLDOMNamedNodeMap_get_item(map, i, &item); - todo_wine_if(test->todo) ok(SUCCEEDED(hr), "Failed to get item, hr %#lx.\n", hr); - if (FAILED(hr)) continue;
str = NULL; hr = IXMLDOMNode_get_nodeName(item, &str); @@ -274,9 +272,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), "Failed to get prefix, hr %#lx.\n", hr); ok(!lstrcmpW(str, _bstr_(test->prefixes[i])) || broken(!str), "got %s\n", wine_dbgstr_w(str)); + } SysFreeString(str); } else @@ -286,6 +286,7 @@ static void test_namespaces_as_attributes(void) hr = IXMLDOMNode_get_baseName(item, &str); ok(SUCCEEDED(hr), "Failed to get base name, hr %#lx.\n", hr); /* MSXML4 can report different results with different service packs */ + todo_wine_if(test->todo) ok(!lstrcmpW(str, _bstr_(test->basenames[i])) || broken(!lstrcmpW(str, L"xmlns")), "got %s\n", wine_dbgstr_w(str)); SysFreeString(str); @@ -294,11 +295,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, "Failed to get namespace URI, hr %#lx.\n", hr); if (test->prefixes[i] && !strcmp(test->prefixes[i], "xmlns")) ok(!lstrcmpW(str, L""), "got %s\n", wine_dbgstr_w(str)); else ok(!lstrcmpW(str, _bstr_(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 db1f5a5b9c0..3035a45c350 100644 --- a/dlls/msxml6/tests/domdoc.c +++ b/dlls/msxml6/tests/domdoc.c @@ -266,9 +266,7 @@ static void test_namespaces_as_attributes(void) { item = NULL; hr = IXMLDOMNamedNodeMap_get_item(map, i, &item); - todo_wine_if(test->todo) ok(SUCCEEDED(hr), "Failed to get item, hr %#lx.\n", hr); - if (FAILED(hr)) continue;
str = NULL; hr = IXMLDOMNode_get_nodeName(item, &str); @@ -280,8 +278,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, "Failed to get prefix, hr %#lx.\n", hr); ok(!lstrcmpW(str, _bstr_(test->prefixes[i])), "got %s\n", wine_dbgstr_w(str)); + } SysFreeString(str); } else @@ -297,12 +297,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, "Failed to get namespace URI, hr %#lx.\n", hr); if (test->prefixes[i] && !strcmp(test->prefixes[i], "xmlns")) ok(!lstrcmpW(str, L"http://www.w3.org/2000/xmlns/"), "got %s\n", wine_dbgstr_w(str)); else ok(!lstrcmpW(str, _bstr_(test->uris[i])), "got %s\n", wine_dbgstr_w(str)); + } SysFreeString(str); } else