Commit 3697bd9a authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite/reader: Return empty string for namespace uri for some nodes.

parent 63c489fa
......@@ -3011,6 +3011,15 @@ static HRESULT WINAPI xmlreader_GetNamespaceUri(IXmlReader* iface, const WCHAR *
}
}
break;
case XmlNodeType_Text:
case XmlNodeType_CDATA:
case XmlNodeType_ProcessingInstruction:
case XmlNodeType_Comment:
case XmlNodeType_Whitespace:
case XmlNodeType_XmlDeclaration:
*uri = emptyW;
*len = 0;
break;
default:
FIXME("Unhandled node type %d\n", nodetype);
return E_NOTIMPL;
......
......@@ -2116,6 +2116,18 @@ static void test_namespaceuri(void)
{ "defns a", "ns r", "defns a" }},
{ "<a><b><c/></b></a>",
{ "", "", "", "", "" }},
{ "<a>text</a>",
{ "", "", "" }},
{ "<a>\r\n</a>",
{ "", "", "" }},
{ "<a><![CDATA[data]]></a>",
{ "", "", "" }},
{ "<?xml version=\"1.0\" ?><a/>",
{ "", "" }},
{ "<a><?pi ?></a>",
{ "", "", "" }},
{ "<a><!-- comment --></a>",
{ "", "", "" }},
};
IXmlReader *reader;
XmlNodeType type;
......@@ -2137,13 +2149,22 @@ static void test_namespaceuri(void)
const WCHAR *uri, *local;
WCHAR *uriW;
ok(type == XmlNodeType_Element || type == XmlNodeType_EndElement, "Unexpected node type %d.\n", type);
ok(type == XmlNodeType_Element ||
type == XmlNodeType_Text ||
type == XmlNodeType_CDATA ||
type == XmlNodeType_ProcessingInstruction ||
type == XmlNodeType_Comment ||
type == XmlNodeType_Whitespace ||
type == XmlNodeType_EndElement ||
type == XmlNodeType_XmlDeclaration, "Unexpected node type %d.\n", type);
hr = IXmlReader_GetLocalName(reader, &local, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
uri = NULL;
hr = IXmlReader_GetNamespaceUri(reader, &uri, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
ok(uri != NULL, "Unexpected NULL uri pointer\n");
uriW = a2w(uri_tests[i].uri[j]);
ok(!lstrcmpW(uriW, uri), "%s: uri %s\n", wine_dbgstr_w(local), wine_dbgstr_w(uri));
......
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