Commit 0b31c53e authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msxml3: Handle null prefix in get_item.

parent d81df26f
......@@ -1827,11 +1827,16 @@ static HRESULT domelem_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode *
if (attrIndex < index)
return S_FALSE;
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);
}
if (!curr) {
xmlFreeNs(xmlns);
return E_OUTOFMEMORY;
......
......@@ -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));
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment