diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c index 76af4c660e0..4b9bf6cae04 100644 --- a/dlls/msxml3/element.c +++ b/dlls/msxml3/element.c @@ -582,8 +582,33 @@ static HRESULT WINAPI domelem_getAttributeNode( IXMLDOMElement *iface, BSTR p, IXMLDOMAttribute** attributeNode ) { - FIXME("\n"); - return E_NOTIMPL; + domelem *This = impl_from_IXMLDOMElement( iface ); + xmlChar *xml_name; + xmlNodePtr element; + xmlAttrPtr attr; + IUnknown *unk; + HRESULT hr = E_FAIL; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), attributeNode); + + element = get_element( This ); + if ( !element ) + return E_FAIL; + + xml_name = xmlChar_from_wchar(p); + + attr = xmlHasProp(element, xml_name); + if(attr) { + unk = create_attribute((xmlNodePtr)attr); + hr = IUnknown_QueryInterface(unk, &IID_IXMLDOMAttribute, (void**)attributeNode); + IUnknown_Release(unk); + }else { + *attributeNode = NULL; + } + + HeapFree(GetProcessHeap(), 0, xml_name); + + return hr; } static HRESULT WINAPI domelem_setAttributeNode( diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 0479d8037e4..d5c463d29f1 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -939,10 +939,8 @@ static void test_domnode( void ) attr = (IXMLDOMAttribute*)0xdeadbeef; r = IXMLDOMElement_getAttributeNode( element, str, &attr); - todo_wine { ok( r == E_FAIL, "getAttributeNode ret %08x\n", r ); ok( attr == NULL, "getAttributeNode ret %p, expected NULL\n", attr ); - } SysFreeString( str ); str = SysAllocString( szdl ); @@ -962,10 +960,8 @@ static void test_domnode( void ) attr = NULL; r = IXMLDOMElement_getAttributeNode( element, str, &attr); - todo_wine { ok( r == S_OK, "GetAttributeNode ret %08x\n", r ); ok( attr != NULL, "getAttributeNode returned NULL\n" ); - } if(attr) IXMLDOMAttribute_Release(attr);