msxml3: Cannot use put_nodeValue on a IXMLDOMProcessingInstruction node whose target is xml.

This commit is contained in:
Alistair Leslie-Hughes 2008-03-13 20:30:12 +11:00 committed by Alexandre Julliard
parent 442f29ab49
commit 52f6a33a85
2 changed files with 26 additions and 0 deletions

View File

@ -200,6 +200,25 @@ static HRESULT WINAPI dom_pi_put_nodeValue(
VARIANT var1 )
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
BSTR sTarget;
static WCHAR szXML[] = {'x','m','l',0};
HRESULT hr;
TRACE("%p\n", This );
/* 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);
}
return IXMLDOMNode_put_nodeValue( This->node, var1 );
}

View File

@ -786,6 +786,13 @@ static void test_domdoc( void )
r = IXMLDOMProcessingInstruction_put_data(nodePI, _bstr_("version=\"1.0\" encoding=\"UTF-8\""));
ok(r == E_FAIL, "ret %08x\n", r );
/* test put_data */
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = SysAllocString(szOpen); /* Doesnt matter what the string is, cannot set an xml node. */
r = IXMLDOMProcessingInstruction_put_nodeValue(nodePI, var);
ok(r == E_FAIL, "ret %08x\n", r );
VariantClear(&var);
/* test get nodeName */
r = IXMLDOMProcessingInstruction_get_nodeName(nodePI, &str);
ok( !lstrcmpW( str, _bstr_("xml") ), "incorrect nodeName string\n");