Commit 38844dc3 authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msxml3: Handle namespaces in removeNamedItem.

parent f726691b
...@@ -1749,8 +1749,43 @@ static HRESULT domelem_remove_qualified_item(xmlNodePtr node, BSTR name, BSTR ur ...@@ -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) 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); 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) static HRESULT domelem_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode **item)
......
...@@ -4164,18 +4164,18 @@ static void test_removeNamedItem(void) ...@@ -4164,18 +4164,18 @@ static void test_removeNamedItem(void)
removed_node = NULL; removed_node = NULL;
r = IXMLDOMNamedNodeMap_removeNamedItem( map, _bstr_("ns:b"), &removed_node ); r = IXMLDOMNamedNodeMap_removeNamedItem( map, _bstr_("ns:b"), &removed_node );
todo_wine EXPECT_HR(r, S_OK); EXPECT_HR(r, S_OK);
if (removed_node) IXMLDOMNode_Release( removed_node ); IXMLDOMNode_Release( removed_node );
removed_node = NULL; removed_node = NULL;
r = IXMLDOMNamedNodeMap_removeNamedItem( map, _bstr_("xml:lang"), &removed_node ); r = IXMLDOMNamedNodeMap_removeNamedItem( map, _bstr_("xml:lang"), &removed_node );
todo_wine EXPECT_HR(r, S_OK); EXPECT_HR(r, S_OK);
if (removed_node) IXMLDOMNode_Release( removed_node ); IXMLDOMNode_Release( removed_node );
len = -1; len = -1;
r = IXMLDOMNamedNodeMap_get_length( map, &len ); r = IXMLDOMNamedNodeMap_get_length( map, &len );
EXPECT_HR(r, S_OK); EXPECT_HR(r, S_OK);
todo_wine ok( len == 2, "length %d\n", len ); ok( len == 2, "length %d\n", len );
IXMLDOMNamedNodeMap_Release( map ); IXMLDOMNamedNodeMap_Release( map );
IXMLDOMElement_Release( element ); IXMLDOMElement_Release( element );
......
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