[PATCH] Implement IXMLDOMComment appendData

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Thu Mar 13 05:19:24 CDT 2008


---
 dlls/msxml3/comment.c      |   28 ++++++++++++++++++++++++++--
 dlls/msxml3/tests/domdoc.c |   15 +++++++++++++++
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c
index be2beb2..3229465 100644
--- a/dlls/msxml3/comment.c
+++ b/dlls/msxml3/comment.c
@@ -583,8 +583,32 @@ static HRESULT WINAPI domcomment_appendData(
     IXMLDOMComment *iface,
     BSTR p)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    domcomment *This = impl_from_IXMLDOMComment( iface );
+    xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
+    xmlChar *pContent;
+    HRESULT hr = S_FALSE;
+
+    TRACE("%p\n", iface);
+
+    /* Nothing to do if NULL or an Empty string passed in. */
+    if(p == NULL || SysStringLen(p) == 0)
+        return S_OK;
+
+    pContent = xmlChar_from_wchar( (WCHAR*)p );
+    if(pContent)
+    {
+        if(xmlTextConcat(pDOMNode->node, pContent, SysStringLen(p) ) == 0)
+            hr = S_OK;
+        else
+        {
+            hr = E_FAIL;
+            xmlFree(pContent);
+        }
+    }
+    else
+        hr = E_FAIL;
+
+    return hr;
 }
 
 static HRESULT WINAPI domcomment_insertData(
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index b675aa7..382793c 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -2282,6 +2282,21 @@ static void test_xmlTypes(void)
                 ok(hr == S_OK, "ret %08x\n", hr );
                 ok( !lstrcmpW( str, _bstr_("\\") ), "incorrect substringData string\n");
                 SysFreeString(str);
+                
+                /* test appendData */
+                hr = IXMLDOMComment_appendData(pComment, NULL);
+                ok(hr == S_OK, "ret %08x\n", hr );
+
+                hr = IXMLDOMComment_appendData(pComment, _bstr_(""));
+                ok(hr == S_OK, "ret %08x\n", hr );
+
+                hr = IXMLDOMComment_appendData(pComment, _bstr_("Append"));
+                ok(hr == S_OK, "ret %08x\n", hr );
+
+                hr = IXMLDOMComment_get_text(pComment, &str);
+                ok(hr == S_OK, "ret %08x\n", hr );
+                ok( !lstrcmpW( str, _bstr_("This &is a ; test <>\\Append") ), "incorrect get_text string\n");
+                SysFreeString(str);
 
                 IXMLDOMComment_Release(pComment);
             }
-- 
1.5.4.1


--------------010007020507000801020404--




More information about the wine-patches mailing list