>From cfe2576ac041b7ab3317ba0bdeb7791f6f5e12e4 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov@codeweavers.com>
Date: Mon, 14 Nov 2011 14:26:46 +0300
Subject: [PATCH 5/7] Fix get_namespaceURI()

---
 dlls/msxml3/node.c         |   16 +++++++++++-----
 dlls/msxml3/tests/domdoc.c |    2 --
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index 184463f..19c91f5 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -1054,18 +1054,24 @@ HRESULT node_select_singlenode(const xmlnode *This, BSTR query, IXMLDOMNode **no
 
 HRESULT node_get_namespaceURI(xmlnode *This, BSTR *namespaceURI)
 {
-    xmlNsPtr *ns;
-
     if(!namespaceURI)
         return E_INVALIDARG;
 
     *namespaceURI = NULL;
 
-    if ((ns = xmlGetNsList(This->node->doc, This->node)))
+    switch (This->node->type)
+    {
+    case XML_ELEMENT_NODE:
+    case XML_ATTRIBUTE_NODE:
     {
-        if (ns[0]->href) *namespaceURI = bstr_from_xmlChar( ns[0]->href );
-        xmlFree(ns);
+        xmlNsPtr ns = This->node->ns;
+        if (ns && ns->href)
+            *namespaceURI = bstr_from_xmlChar(ns->href);
+        break;
     }
+    default:
+        FIXME("unsupported type %d\n", This->node->type);
+    };
 
     TRACE("uri: %s\n", debugstr_w(*namespaceURI));
 
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index bad088f..699382f 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -8712,10 +8712,8 @@ static void test_get_prefix(void)
 
     str = (void*)0xdeadbeef;
     hr = IXMLDOMElement_get_namespaceURI(element, &str);
-todo_wine {
     EXPECT_HR(hr, S_FALSE);
     ok(str == NULL, "got %s\n", wine_dbgstr_w(str));
-}
 
     IXMLDOMDocument_Release(doc);
     free_bstrs();
-- 
1.5.6.5


