msxml3: Implement createComment.

This commit is contained in:
Alistair Leslie-Hughes 2008-01-04 09:08:35 +11:00 committed by Alexandre Julliard
parent 48c0e684cb
commit 2e3f5243ca
2 changed files with 33 additions and 2 deletions

View File

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

View File

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