Signed-off-by: Daniel Lehman dlehman25@gmail.com --- dlls/msxml3/element.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/msxml3/tests/domdoc.c | 10 +++++----- 2 files changed, 41 insertions(+), 6 deletions(-)
diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c index ecebd39feaa..a352621bfb3 100644 --- a/dlls/msxml3/element.c +++ b/dlls/msxml3/element.c @@ -1749,8 +1749,43 @@ static HRESULT domelem_remove_qualified_item(xmlNodePtr node, BSTR name, BSTR ur
static HRESULT domelem_remove_named_item(xmlNodePtr node, BSTR name, IXMLDOMNode **item) { + xmlChar *nameA, *local, *prefix; + BSTR uriW, localW; + xmlNsPtr ns; + HRESULT hr; + TRACE("(%p)->(%s %p)\n", node, debugstr_w(name), item); - return domelem_remove_qualified_item(node, name, NULL, item); + + nameA = xmlchar_from_wchar(name); + local = xmlSplitQName2(nameA, &prefix); + heap_free(nameA); + + if (!local) + return domelem_remove_qualified_item(node, name, NULL, item); + + ns = xmlSearchNs(node->doc, node, prefix); + + xmlFree(prefix); + + if (!ns) + { + xmlFree(local); + if (item) *item = NULL; + return item ? S_FALSE : E_INVALIDARG; + } + + uriW = bstr_from_xmlChar(ns->href); + localW = bstr_from_xmlChar(local); + xmlFree(local); + + TRACE("removing qualified node %s, uri=%s\n", debugstr_w(localW), debugstr_w(uriW)); + + hr = domelem_remove_qualified_item(node, localW, uriW, item); + + SysFreeString(localW); + SysFreeString(uriW); + + return hr; }
static HRESULT domelem_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode **item) diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 2f8e7e1993d..f990ebbfa54 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -4164,18 +4164,18 @@ static void test_removeNamedItem(void)
removed_node = NULL; r = IXMLDOMNamedNodeMap_removeNamedItem( map, _bstr_("ns:b"), &removed_node ); - todo_wine EXPECT_HR(r, S_OK); - if (removed_node) IXMLDOMNode_Release( removed_node ); + EXPECT_HR(r, S_OK); + IXMLDOMNode_Release( removed_node );
removed_node = NULL; r = IXMLDOMNamedNodeMap_removeNamedItem( map, _bstr_("xml:lang"), &removed_node ); - todo_wine EXPECT_HR(r, S_OK); - if (removed_node) IXMLDOMNode_Release( removed_node ); + EXPECT_HR(r, S_OK); + IXMLDOMNode_Release( removed_node );
len = -1; r = IXMLDOMNamedNodeMap_get_length( map, &len ); EXPECT_HR(r, S_OK); - todo_wine ok( len == 2, "length %d\n", len ); + ok( len == 2, "length %d\n", len );
IXMLDOMNamedNodeMap_Release( map ); IXMLDOMElement_Release( element );