msxml3: Correct IXMLDOMProcessingInstruction_put_data function.

This commit is contained in:
Alistair Leslie-Hughes 2008-02-29 20:54:53 +11:00 committed by Alexandre Julliard
parent ad606f4d26
commit c61937b6d4
2 changed files with 16 additions and 13 deletions

View file

@ -506,9 +506,24 @@ static HRESULT WINAPI dom_pi_put_data(
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
HRESULT hr = E_FAIL;
VARIANT val;
BSTR sTarget;
static WCHAR szXML[] = {'x','m','l',0};
TRACE("%p %s\n", This, debugstr_w(data) );
/* Cannot set data to a PI node whos target is 'xml' */
hr = dom_pi_get_nodeName(iface, &sTarget);
if(hr == S_OK)
{
if(lstrcmpW( sTarget, szXML) == 0)
{
SysFreeString(sTarget);
return E_FAIL;
}
SysFreeString(sTarget);
}
V_VT(&val) = VT_BSTR;
V_BSTR(&val) = data;

View file

@ -682,19 +682,7 @@ static void test_domdoc( void )
/* test put_data */
r = IXMLDOMProcessingInstruction_put_data(nodePI, _bstr_("version=\"1.0\" encoding=\"UTF-8\""));
ok(r == S_OK, "ret %08x\n", r );
SysFreeString(str);
r = IXMLDOMProcessingInstruction_get_data(nodePI, &str);
ok(r == S_OK, "ret %08x\n", r );
ok( !lstrcmpW( str, _bstr_("version=\"1.0\" encoding=\"UTF-8\"") ), "incorrect data string\n");
SysFreeString(str);
/* Confirm XML text is good */
r = IXMLDOMProcessingInstruction_get_xml(nodePI, &str);
ok(r == S_OK, "ret %08x\n", r );
ok( !lstrcmpW( str, _bstr_("<?xml version=\"1.0\" encoding=\"UTF-8\"?>") ), "incorrect xml string\n");
SysFreeString(str);
ok(r == E_FAIL, "ret %08x\n", r );
IXMLDOMProcessingInstruction_Release(nodePI);
}