diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index 47ce60d4a55..894350770dc 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -2508,10 +2508,13 @@ static HRESULT WINAPI domdoc_put_onTransformNode( static HRESULT WINAPI domdoc_get_namespaces( IXMLDOMDocument3* iface, - IXMLDOMSchemaCollection** schemaCollection ) + IXMLDOMSchemaCollection** collection ) { domdoc *This = impl_from_IXMLDOMDocument3( iface ); - FIXME("(%p)->(%p)\n", This, schemaCollection); + FIXME("(%p)->(%p): stub\n", This, collection); + + if (!collection) return E_POINTER; + return E_NOTIMPL; } diff --git a/dlls/msxml3/schema.c b/dlls/msxml3/schema.c index 7473dbbbded..2312f6d98fc 100644 --- a/dlls/msxml3/schema.c +++ b/dlls/msxml3/schema.c @@ -1139,10 +1139,13 @@ static HRESULT WINAPI schema_cache_get(IXMLDOMSchemaCollection2* iface, BSTR uri IXMLDOMNode** node) { schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface); - xmlChar* name; cache_entry* entry; + xmlChar* name; + TRACE("(%p)->(%s %p)\n", This, wine_dbgstr_w(uri), node); + if (This->version == MSXML6) return E_NOTIMPL; + if (!node) return E_POINTER; @@ -1438,7 +1441,7 @@ HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* outer, void** obj) #else -HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* pUnkOuter, void** ppObj) +HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* outer, void** obj) { MESSAGE("This program tried to use a SchemaCache object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 21809f8f86e..cc01a250770 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -11140,6 +11140,86 @@ static void test_nodeValue(void) IXMLDOMDocument_Release(doc); } +static char namespacesA[] = +"" +" " +" " +" " +" " +" " +" true" +" "; + +static void test_get_namespaces(void) +{ + IXMLDOMSchemaCollection *collection, *collection2; + IXMLDOMDocument2 *doc; + IXMLDOMNode *node; + VARIANT_BOOL b; + HRESULT hr; + LONG len; + + doc = create_document(&IID_IXMLDOMDocument2); + if (!doc) return; + + /* null pointer */ + hr = IXMLDOMDocument2_get_namespaces(doc, NULL); + EXPECT_HR(hr, E_POINTER); + + /* no document loaded */ + collection = (void*)0xdeadbeef; + hr = IXMLDOMDocument2_get_namespaces(doc, &collection); +todo_wine + EXPECT_HR(hr, S_OK); + if (hr != S_OK) + { + IXMLDOMDocument_Release(doc); + return; + } + EXPECT_REF(collection, 2); + + collection2 = (void*)0xdeadbeef; + hr = IXMLDOMDocument2_get_namespaces(doc, &collection2); + EXPECT_HR(hr, S_OK); + ok(collection == collection2, "got %p\n", collection2); + EXPECT_REF(collection, 3); + IXMLDOMSchemaCollection_Release(collection); + + len = -1; + hr = IXMLDOMSchemaCollection_get_length(collection, &len); + EXPECT_HR(hr, S_OK); + ok(len == 0, "got %d\n", len); + IXMLDOMSchemaCollection_Release(collection); + + /* now with document */ + hr = IXMLDOMDocument2_loadXML(doc, _bstr_(namespacesA), &b); + EXPECT_HR(hr, S_OK); + + hr = IXMLDOMDocument2_get_namespaces(doc, &collection); + EXPECT_HR(hr, S_OK); + + len = -1; + hr = IXMLDOMSchemaCollection_get_length(collection, &len); + EXPECT_HR(hr, S_OK); + ok(len == 2, "got %d\n", len); + + /* try to lookup some uris */ + node = (void*)0xdeadbeef; + hr = IXMLDOMSchemaCollection_get(collection, _bstr_("http://blah.org"), &node); + EXPECT_HR(hr, S_OK); + ok(node == NULL, "got %p\n", node); + + node = (void*)0xdeadbeef; + hr = IXMLDOMSchemaCollection_get(collection, _bstr_("http://blah1.org"), &node); + EXPECT_HR(hr, S_OK); + ok(node == NULL, "got %p\n", node); + + IXMLDOMSchemaCollection_Release(collection); + + IXMLDOMDocument2_Release(doc); + free_bstrs(); +} + START_TEST(domdoc) { IXMLDOMDocument *doc; @@ -11216,6 +11296,7 @@ START_TEST(domdoc) test_getAttributeNode(); test_supporterrorinfo(); test_nodeValue(); + test_get_namespaces(); test_xsltemplate(); diff --git a/dlls/msxml3/tests/schema.c b/dlls/msxml3/tests/schema.c index 59ceac5e02f..e81926427ff 100644 --- a/dlls/msxml3/tests/schema.c +++ b/dlls/msxml3/tests/schema.c @@ -2061,6 +2061,41 @@ static void test_dispex(void) IXMLDOMSchemaCollection_Release(cache); } +static void test_get(void) +{ + static const WCHAR uriW[] = {'u','r','i',0}; + IXMLDOMSchemaCollection2 *cache; + IXMLDOMNode *node; + HRESULT hr; + BSTR s; + + cache = create_cache_version(60, &IID_IXMLDOMSchemaCollection2); + if (!cache) return; + + hr = IXMLDOMSchemaCollection2_get(cache, NULL, NULL); + EXPECT_HR(hr, E_NOTIMPL); + + s = SysAllocString(uriW); + hr = IXMLDOMSchemaCollection2_get(cache, s, &node); + EXPECT_HR(hr, E_NOTIMPL); + SysFreeString(s); + + IXMLDOMSchemaCollection2_Release(cache); + + cache = create_cache_version(40, &IID_IXMLDOMSchemaCollection2); + if (!cache) return; + + hr = IXMLDOMSchemaCollection2_get(cache, NULL, NULL); + EXPECT_HR(hr, E_POINTER); + + s = SysAllocString(uriW); + hr = IXMLDOMSchemaCollection2_get(cache, s, &node); + EXPECT_HR(hr, S_OK); + SysFreeString(s); + + IXMLDOMSchemaCollection2_Release(cache); +} + START_TEST(schema) { HRESULT r; @@ -2076,6 +2111,7 @@ START_TEST(schema) test_XDR_datatypes(); test_validate_on_load(); test_dispex(); + test_get(); CoUninitialize(); }