msxml3: Implement setNamedItem.

This commit is contained in:
Alistair Leslie-Hughes 2008-01-04 09:06:03 +11:00 committed by Alexandre Julliard
parent f427951d04
commit 48c0e684cb
3 changed files with 55 additions and 16 deletions

View File

@ -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__ */

View File

@ -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));

View File

@ -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(