Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/msxml3/node.c | 4 ++-- dlls/msxml3/pi.c | 24 +++++++++++++++++++++--- dlls/msxml3/tests/domdoc.c | 5 ----- 3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c index 67f322eb0e5..36136df6c4b 100644 --- a/dlls/msxml3/node.c +++ b/dlls/msxml3/node.c @@ -1665,7 +1665,7 @@ void destroy_xmlnode(xmlnode *This) if(This->node) { xmlnode_release(This->node); - xmldoc_release(This->node->doc); + if (This->node->doc) xmldoc_release(This->node->doc); } }
@@ -1674,7 +1674,7 @@ void init_xmlnode(xmlnode *This, xmlNodePtr node, IXMLDOMNode *node_iface, dispe if(node) { xmlnode_add_ref(node); - xmldoc_add_ref(node->doc); + if (node->doc) xmldoc_add_ref(node->doc); }
This->node = node; diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c index 6bacff12027..d0634c9e87b 100644 --- a/dlls/msxml3/pi.c +++ b/dlls/msxml3/pi.c @@ -790,10 +790,28 @@ static HRESULT dom_pi_get_qualified_item(const xmlNodePtr node, BSTR name, BSTR
static HRESULT dom_pi_get_named_item(const xmlNodePtr node, BSTR name, IXMLDOMNode **item) { - FIXME("(%p)->(%s %p): stub\n", node, debugstr_w(name), item ); - if (item) + xmlChar *nameA; + xmlAttrPtr attr; + + TRACE("(%p)->(%s %p)\n", node, debugstr_w(name), item); + + if (!item) return E_POINTER; + + nameA = xmlchar_from_wchar(name); + if (!nameA) return E_OUTOFMEMORY; + + attr = xmlHasProp(node, nameA); + heap_free(nameA); + + if (!attr) + { *item = NULL; - return S_FALSE; + return S_FALSE; + } + + *item = create_node((xmlNodePtr)attr); + + return S_OK; }
static HRESULT dom_pi_set_named_item(xmlNodePtr node, IXMLDOMNode *newItem, IXMLDOMNode **namedItem) diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 3dcfdb8fd39..12482962c4b 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -8579,13 +8579,9 @@ todo_wine
item = NULL; hr = IXMLDOMNamedNodeMap_getNamedItem(node_map, _bstr_("encoding"), &item); -todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); -todo_wine ok(item != NULL, "got NULL\n");
-if (hr == S_OK) -{ hr = IXMLDOMNode_get_nodeName(item, &bstr); ok(hr == S_OK, "got 0x%08x\n", hr); ok(!lstrcmpW(bstr, L"encoding"), "got %s\n", wine_dbgstr_w(bstr)); @@ -8597,7 +8593,6 @@ if (hr == S_OK) ok(V_VT(&var) == VT_BSTR, "got %u\n", V_VT(&var)); ok(!lstrcmpW(V_BSTR(&var), L"windows-1252"), "got %s\n", wine_dbgstr_w(V_BSTR(&var))); VariantClear(&var); -}
IXMLDOMNamedNodeMap_Release(node_map); IXMLDOMNode_Release(node);