[6/7] msxml3: Basic implementation of IXMLDOMNode::replaceChild
Michael Karcher
wine at mkarcher.dialup.fu-berlin.de
Sun Oct 5 05:13:46 CDT 2008
---
dlls/msxml3/node.c | 22 ++++++++++++++++++++--
dlls/msxml3/tests/domdoc.c | 9 ++-------
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index ffb88e9..93166d5 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -610,6 +610,7 @@ static HRESULT WINAPI xmlnode_replaceChild(
IXMLDOMNode** outOldChild)
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
+ xmlNode *child_node_ptr;
TRACE("%p->(%p,%p,%p)\n",This,newChild,oldChild,outOldChild);
@@ -618,8 +619,25 @@ static HRESULT WINAPI xmlnode_replaceChild(
if(!newChild || !oldChild)
return E_INVALIDARG;
- FIXME("not implemented\n");
- return E_NOTIMPL;
+ if(outOldChild)
+ *outOldChild = NULL;
+
+ child_node_ptr = impl_from_IXMLDOMNode(oldChild)->node;
+ if(child_node_ptr->parent != This->node)
+ {
+ WARN("childNode %p is not a child of %p\n", oldChild, iface);
+ return E_INVALIDARG;
+ }
+
+ xmlReplaceNode(child_node_ptr, impl_from_IXMLDOMNode(newChild)->node);
+
+ if(outOldChild)
+ {
+ IXMLDOMNode_AddRef(oldChild);
+ *outOldChild = oldChild;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI xmlnode_removeChild(
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 769d35d..c29471e 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -1890,12 +1890,7 @@ static void test_replaceChild(void)
/* invalid parameter: OldNode is not a child */
removed_node = (void*)0xdeadbeef;
r = IXMLDOMElement_replaceChild( element, ba_node, ba_node, &removed_node );
- todo_wine ok( r == E_INVALIDARG, "ret %08x\n", r );
- if( r == E_NOTIMPL)
- {
- skip("replaceChild not implemented\n");
- return;
- }
+ ok( r == E_INVALIDARG, "ret %08x\n", r );
ok( removed_node == NULL, "%p\n", removed_node );
r = IXMLDOMElement_replaceChild( element, ba_node, fo_node, NULL );
@@ -1911,7 +1906,7 @@ static void test_replaceChild(void)
ok( r == S_OK, "ret %08x\n", r );
r = IXMLDOMNode_QueryInterface( ba_node, &IID_IUnknown, (void**)&unk2);
ok( r == S_OK, "ret %08x\n", r );
- ok( unk1 == unk2, "unk1 %p unk2 %p\n", unk1, unk2);
+ todo_wine ok( unk1 == unk2, "unk1 %p unk2 %p\n", unk1, unk2);
IUnknown_Release( unk1 );
IUnknown_Release( unk2 );
--
1.5.6.5
More information about the wine-patches
mailing list