msxml3: Implement put_text.

This commit is contained in:
Alistair Leslie-Hughes 2008-01-16 13:44:51 +11:00 committed by Alexandre Julliard
parent 38f1733ce3
commit b2101b8177
2 changed files with 35 additions and 2 deletions

View File

@ -697,8 +697,29 @@ static HRESULT WINAPI xmlnode_put_text(
IXMLDOMNode *iface,
BSTR text)
{
FIXME("\n");
return E_NOTIMPL;
xmlnode *This = impl_from_IXMLDOMNode( iface );
xmlChar *str = NULL;
TRACE("%p\n", This);
switch(This->node->type)
{
case XML_DOCUMENT_NODE:
return E_FAIL;
default:
break;
}
str = xmlChar_from_wchar((WCHAR*)text);
/* Escape the string. */
str = xmlEncodeEntitiesReentrant(This->node->doc, str);
str = xmlEncodeSpecialChars(This->node->doc, str);
xmlNodeSetContent(This->node, str);
xmlFree(str);
return S_OK;
}
static HRESULT WINAPI xmlnode_get_specified(

View File

@ -142,6 +142,8 @@ static WCHAR szCommentNodeText[] = {'#','c','o','m','m','e','n','t',0 };
static WCHAR szElement[] = {'E','l','e','T','e','s','t', 0 };
static WCHAR szElementXML[] = {'<','E','l','e','T','e','s','t','/','>',0 };
static WCHAR szElementXML2[] = {'<','E','l','e','T','e','s','t',' ','A','t','t','r','=','"','"','/','>',0 };
static WCHAR szElementXML3[] = {'<','E','l','e','T','e','s','t',' ','A','t','t','r','=','"','"','>',
'T','e','s','t','i','n','g','N','o','d','e','<','/','E','l','e','T','e','s','t','>',0 };
static WCHAR szAttribute[] = {'A','t','t','r',0 };
static WCHAR szAttributeXML[] = {'A','t','t','r','=','"','"',0 };
@ -444,6 +446,9 @@ static void test_domdoc( void )
ok( !lstrcmpW( str, szDocument ), "incorrect nodeName\n");
SysFreeString( str );
/* test put_text */
r = IXMLDOMDocument_put_text( doc, _bstr_("Should Fail") );
ok( r == E_FAIL, "ret %08x\n", r );
/* check that there's a document element */
element = NULL;
@ -2030,6 +2035,13 @@ static void test_xmlTypes(void)
SysFreeString(str);
}
hr = IXMLDOMElement_put_text(pElement, _bstr_("TestingNode"));
ok(hr == S_OK, "ret %08x\n", hr );
hr = IXMLDOMElement_get_xml(pElement, &str);
ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, szElementXML3 ), "incorrect element xml\n");
IXMLDOMElement_Release(pElement);
}