mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-03 00:42:46 +00:00
msxml3: Handle default namespace in get_namespaceURI.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53531
This commit is contained in:
parent
c6f121df19
commit
57a391b85b
|
@ -543,10 +543,11 @@ static HRESULT WINAPI domattr_get_namespaceURI(
|
|||
IXMLDOMAttribute *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
static const WCHAR w3xmlns[] = { 'h','t','t','p',':','/','/', 'w','w','w','.','w','3','.',
|
||||
'o','r','g','/','2','0','0','0','/','x','m','l','n','s','/',0 };
|
||||
domattr *This = impl_from_IXMLDOMAttribute( iface );
|
||||
xmlNsPtr ns = This->node.node->ns;
|
||||
BSTR nodename, pfx;
|
||||
BOOL is6, isdefault;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
|
@ -554,23 +555,36 @@ static HRESULT WINAPI domattr_get_namespaceURI(
|
|||
return E_INVALIDARG;
|
||||
|
||||
*p = NULL;
|
||||
nodename = NULL;
|
||||
hr = IXMLDOMAttribute_get_nodeName(iface, &nodename);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (ns)
|
||||
pfx = NULL;
|
||||
hr = IXMLDOMAttribute_get_prefix(iface, &pfx);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
/* special case for default namespace definition */
|
||||
if (xmlStrEqual(This->node.node->name, xmlns))
|
||||
*p = bstr_from_xmlChar(xmlns);
|
||||
else if (xmlStrEqual(ns->prefix, xmlns))
|
||||
{
|
||||
if (xmldoc_version(This->node.node->doc) == MSXML6)
|
||||
*p = SysAllocString(w3xmlns);
|
||||
else
|
||||
*p = SysAllocStringLen(NULL, 0);
|
||||
}
|
||||
else if (ns->href)
|
||||
*p = bstr_from_xmlChar(ns->href);
|
||||
SysFreeString(nodename);
|
||||
return hr;
|
||||
}
|
||||
|
||||
is6 = xmldoc_version(This->node.node->doc) == MSXML6;
|
||||
isdefault = !wcscmp(nodename, L"xmlns");
|
||||
if (isdefault || (pfx && !wcscmp(L"xmlns", pfx)))
|
||||
{
|
||||
if (is6)
|
||||
*p = SysAllocString(L"http://www.w3.org/2000/xmlns/");
|
||||
else if (!ns || !isdefault)
|
||||
*p = SysAllocStringLen(NULL, 0);
|
||||
else
|
||||
*p = SysAllocString(L"xmlns");
|
||||
}
|
||||
else if (ns && ns->href)
|
||||
*p = bstr_from_xmlChar(ns->href);
|
||||
|
||||
SysFreeString(nodename);
|
||||
SysFreeString(pfx);
|
||||
|
||||
TRACE("uri: %s\n", debugstr_w(*p));
|
||||
|
||||
return *p ? S_OK : S_FALSE;
|
||||
|
|
|
@ -13677,7 +13677,6 @@ static void test_namespaces_as_attributes(void)
|
|||
const char *uris[3];
|
||||
const char *texts[3];
|
||||
const char *xmls[3];
|
||||
BOOL todo;
|
||||
};
|
||||
static const struct test tests[] = {
|
||||
{
|
||||
|
@ -13718,7 +13717,6 @@ static void test_namespaces_as_attributes(void)
|
|||
{ "" }, /* namespaceURI */
|
||||
{ "nshref" }, /* text */
|
||||
{ "xmlns=\"nshref\"" }, /* xml */
|
||||
TRUE, /* todo */
|
||||
},
|
||||
/* no properties or namespaces */
|
||||
{
|
||||
|
@ -13802,7 +13800,6 @@ 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));
|
||||
|
|
|
@ -166,7 +166,6 @@ static void test_namespaces_as_attributes(void)
|
|||
const WCHAR *uris[3];
|
||||
const WCHAR *texts[3];
|
||||
const WCHAR *xmls[3];
|
||||
BOOL todo;
|
||||
};
|
||||
static const struct test tests[] =
|
||||
{
|
||||
|
@ -208,7 +207,6 @@ static void test_namespaces_as_attributes(void)
|
|||
{ L"" }, /* namespaceURI */
|
||||
{ L"nshref" }, /* text */
|
||||
{ L"xmlns=\"nshref\"" }, /* xml */
|
||||
TRUE, /* todo */
|
||||
},
|
||||
/* no properties or namespaces */
|
||||
{
|
||||
|
@ -289,13 +287,11 @@ 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
|
||||
|
|
|
@ -59,12 +59,11 @@ struct attrtest_t {
|
|||
const WCHAR *uri;
|
||||
const WCHAR *prefix;
|
||||
const WCHAR *href;
|
||||
BOOL todo;
|
||||
};
|
||||
|
||||
static struct attrtest_t attrtests[] = {
|
||||
{ L"xmlns", L"http://www.w3.org/2000/xmlns/", NULL, L"http://www.w3.org/2000/xmlns/", TRUE },
|
||||
{ L"xmlns", L"nondefaulturi", NULL, L"http://www.w3.org/2000/xmlns/", TRUE },
|
||||
{ L"xmlns", L"http://www.w3.org/2000/xmlns/", NULL, L"http://www.w3.org/2000/xmlns/" },
|
||||
{ L"xmlns", L"nondefaulturi", NULL, L"http://www.w3.org/2000/xmlns/" },
|
||||
{ L"c", L"http://www.w3.org/2000/xmlns/", NULL, L"http://www.w3.org/2000/xmlns/" },
|
||||
{ L"c", L"nsref1", NULL, L"nsref1" },
|
||||
{ L"ns:c", L"nsref1", L"ns", L"nsref1" },
|
||||
|
@ -113,7 +112,6 @@ static void test_create_attribute(void)
|
|||
str = NULL;
|
||||
hr = IXMLDOMNode_get_namespaceURI(node, &str);
|
||||
ok(hr == S_OK, "%d: unexpected hr %#lx\n", i, hr);
|
||||
todo_wine_if(ptr->todo)
|
||||
ok(!lstrcmpW(str, _bstr_(ptr->href)) ||
|
||||
broken(!ptr->prefix && !lstrcmpW(str, L"xmlns")), /* win7 msxml6 */
|
||||
"%d: got uri %s, expected %s\n", i, wine_dbgstr_w(str), wine_dbgstr_w(ptr->href));
|
||||
|
@ -171,7 +169,6 @@ static void test_namespaces_as_attributes(void)
|
|||
const WCHAR *uris[3];
|
||||
const WCHAR *texts[3];
|
||||
const WCHAR *xmls[3];
|
||||
BOOL todo;
|
||||
};
|
||||
static const struct test tests[] =
|
||||
{
|
||||
|
@ -213,7 +210,6 @@ static void test_namespaces_as_attributes(void)
|
|||
{ L"http://www.w3.org/2000/xmlns/" }, /* namespaceURI */
|
||||
{ L"nshref" }, /* text */
|
||||
{ L"xmlns=\"nshref\"" }, /* xml */
|
||||
TRUE, /* todo */
|
||||
},
|
||||
/* no properties or namespaces */
|
||||
{
|
||||
|
@ -273,10 +269,8 @@ 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
|
||||
|
@ -292,14 +286,12 @@ 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
|
||||
|
|
Loading…
Reference in a new issue