Alistair Leslie-Hughes : msxml3: Implement createComment.
Alexandre Julliard
julliard at winehq.org
Fri Jan 4 07:12:41 CST 2008
Module: wine
Branch: master
Commit: 2e3f5243ca4ba543a386191fc3ac847d5741f111
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2e3f5243ca4ba543a386191fc3ac847d5741f111
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Fri Jan 4 09:08:35 2008 +1100
msxml3: Implement createComment.
---
dlls/msxml3/domdoc.c | 25 +++++++++++++++++++++++--
dlls/msxml3/tests/domdoc.c | 10 ++++++++++
2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index af5097c..ab5f03e 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -909,8 +909,29 @@ static HRESULT WINAPI domdoc_createComment(
BSTR data,
IXMLDOMComment** comment )
{
- FIXME("\n");
- return E_NOTIMPL;
+ domdoc *This = impl_from_IXMLDOMDocument2( iface );
+ xmlNodePtr xmlnode;
+ xmlChar *xml_content;
+
+ TRACE("%p->(%s %p)\n", iface, debugstr_w(data), comment);
+
+ if(!comment)
+ return E_INVALIDARG;
+
+ *comment = NULL;
+
+ xml_content = xmlChar_from_wchar((WCHAR*)data);
+ xmlnode = xmlNewComment(xml_content);
+ HeapFree(GetProcessHeap(), 0, xml_content);
+
+ if(!xmlnode)
+ return E_FAIL;
+
+ xmlnode->doc = get_doc( This );
+
+ *comment = (IXMLDOMComment*)create_comment(xmlnode);
+
+ return S_OK;
}
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 9c5e680..7865d9b 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -135,6 +135,8 @@ static const WCHAR szstr2[] = { 's','t','r','2',0 };
static const WCHAR szstar[] = { '*',0 };
static const WCHAR szfn1_txt[] = {'f','n','1','.','t','x','t',0};
+static WCHAR szComment[] = {'A',' ','C','o','m','m','e','n','t',0 };
+
#define expect_bstr_eq_and_free(bstr, expect) { \
BSTR bstrExp = alloc_str_from_narrow(expect); \
ok(lstrcmpW(bstr, bstrExp) == 0, "String differs\n"); \
@@ -334,6 +336,7 @@ static void test_domdoc( void )
IXMLDOMElement *element = NULL;
IXMLDOMNode *node;
IXMLDOMText *nodetext = NULL;
+ IXMLDOMComment *node_comment = NULL;
VARIANT_BOOL b;
VARIANT var;
BSTR str;
@@ -498,6 +501,13 @@ static void test_domdoc( void )
IXMLDOMText_Release( nodetext );
SysFreeString( str );
+ /* test Create Comment */
+ r = IXMLDOMDocument_createComment(doc, NULL, NULL);
+ ok( r == E_INVALIDARG, "returns %08x\n", r );
+ r = IXMLDOMDocument_createComment(doc, szComment, &node_comment);
+ ok( r == S_OK, "returns %08x\n", r );
+ IXMLDOMText_Release( node_comment );
+
r = IXMLDOMDocument_Release( doc );
ok( r == 0, "document ref count incorrect\n");
More information about the wine-cvs
mailing list