Commit b2101b81 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

msxml3: Implement put_text.

parent 38f1733c
......@@ -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(
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment