diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h index 4914a58ee38..59b1831a51c 100644 --- a/dlls/msxml3/msxml_private.h +++ b/dlls/msxml3/msxml_private.h @@ -71,4 +71,19 @@ extern HRESULT DOMDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj ); extern HRESULT SchemaCache_create( IUnknown *pUnkOuter, LPVOID *ppObj ); extern HRESULT XMLDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj ); +/* IXMLDOMNode Internal Structure */ +typedef struct _xmlnode +{ + const struct IXMLDOMNodeVtbl *lpVtbl; + const struct IUnknownVtbl *lpInternalUnkVtbl; + IUnknown *pUnkOuter; + LONG ref; + xmlNodePtr node; +} xmlnode; + +static inline xmlnode *impl_from_IXMLDOMNode( IXMLDOMNode *iface ) +{ + return (xmlnode *)((char*)iface - FIELD_OFFSET(xmlnode, lpVtbl)); +} + #endif /* __MSXML_PRIVATE__ */ diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c index 7122f7d67db..fd86e4e4ff2 100644 --- a/dlls/msxml3/node.c +++ b/dlls/msxml3/node.c @@ -39,20 +39,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml); #ifdef HAVE_LIBXML2 -typedef struct _xmlnode -{ - const struct IXMLDOMNodeVtbl *lpVtbl; - const struct IUnknownVtbl *lpInternalUnkVtbl; - IUnknown *pUnkOuter; - LONG ref; - xmlNodePtr node; -} xmlnode; - -static inline xmlnode *impl_from_IXMLDOMNode( IXMLDOMNode *iface ) -{ - return (xmlnode *)((char*)iface - FIELD_OFFSET(xmlnode, lpVtbl)); -} - static inline xmlnode *impl_from_InternalUnknown( IUnknown *iface ) { return (xmlnode *)((char*)iface - FIELD_OFFSET(xmlnode, lpInternalUnkVtbl)); diff --git a/dlls/msxml3/nodemap.c b/dlls/msxml3/nodemap.c index 94b3f627fd6..53f2171c5d1 100644 --- a/dlls/msxml3/nodemap.c +++ b/dlls/msxml3/nodemap.c @@ -195,8 +195,46 @@ static HRESULT WINAPI xmlnodemap_setNamedItem( IXMLDOMNode* newItem, IXMLDOMNode** namedItem) { - FIXME("\n"); - return E_NOTIMPL; + xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface ); + xmlnode *ThisNew = NULL; + xmlNodePtr nodeNew; + IXMLDOMNode *pAttr = NULL; + xmlNodePtr node; + + TRACE("%p %p %p\n", This, newItem, namedItem ); + + if(!newItem) + return E_INVALIDARG; + + if(namedItem) *namedItem = NULL; + + node = xmlNodePtr_from_domnode( This->node, 0 ); + if ( !node ) + return E_FAIL; + + /* Must be an Attribute */ + IUnknown_QueryInterface(newItem, &IID_IXMLDOMNode, (LPVOID*)&pAttr); + if(pAttr) + { + ThisNew = impl_from_IXMLDOMNode( pAttr ); + + if(ThisNew->node->type != XML_ATTRIBUTE_NODE) + { + IUnknown_Release(pAttr); + return E_FAIL; + } + + nodeNew = xmlAddChild(node, ThisNew->node); + + if(namedItem) + *namedItem = create_node( (xmlNodePtr) nodeNew ); + + IUnknown_Release(pAttr); + + return S_OK; + } + + return E_INVALIDARG; } static HRESULT WINAPI xmlnodemap_removeNamedItem(