msxml3: Implemented xmlnode_get_nodeTypedValue 'int' data type handling.

This commit is contained in:
Piotr Caban 2009-11-18 00:51:17 +01:00 committed by Alexandre Julliard
parent 0a6d3a70ca
commit 44980403da
2 changed files with 32 additions and 4 deletions

View File

@ -959,12 +959,26 @@ inline HRESULT VARIANT_from_xmlChar(xmlChar *str, VARIANT *v, BSTR type)
} }
else else
{ {
FIXME("Type handling not yet implemented\n"); VARIANT src;
V_VT(v) = VT_BSTR; HRESULT hres;
V_BSTR(v) = bstr_from_xmlChar(str);
if(!V_BSTR(v)) if(!lstrcmpiW(type, szInt))
V_VT(v) = VT_I4;
else
{
FIXME("Type handling not yet implemented\n");
V_VT(v) = VT_BSTR;
}
V_VT(&src) = VT_BSTR;
V_BSTR(&src) = bstr_from_xmlChar(str);
if(!V_BSTR(&src))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hres = VariantChangeType(v, &src, 0, V_VT(v));
VariantClear(&src);
return hres;
} }
return S_OK; return S_OK;

View File

@ -153,6 +153,7 @@ static const CHAR szTypeValueXML[] =
" <string2 dt:dt=\"string\">String</string2>\n" " <string2 dt:dt=\"string\">String</string2>\n"
" <number dt:dt=\"number\">12.44</number>\n" " <number dt:dt=\"number\">12.44</number>\n"
" <number2 dt:dt=\"NUMbEr\">-3.71e3</number2>\n" " <number2 dt:dt=\"NUMbEr\">-3.71e3</number2>\n"
" <int dt:dt=\"int\">-13</int>\n"
"</root>"; "</root>";
static const CHAR szBasicTransformSSXMLPart1[] = static const CHAR szBasicTransformSSXMLPart1[] =
@ -4037,6 +4038,19 @@ static void test_NodeTypeValue(void)
IXMLDOMNode_Release(pNode); IXMLDOMNode_Release(pNode);
} }
hr = IXMLDOMDocument2_selectSingleNode(doc, _bstr_("root/int"), &pNode);
ok(hr == S_OK, "ret %08x\n", hr );
if(hr == S_OK)
{
hr = IXMLDOMNode_get_nodeTypedValue(pNode, &v);
ok(hr == S_OK, "ret %08x\n", hr );
ok(V_VT(&v) == VT_I4, "incorrect type\n");
ok(V_I4(&v) == -13, "incorrect value\n");
VariantClear( &v );
IXMLDOMNode_Release(pNode);
}
} }
IXMLDOMDocument2_Release(doc); IXMLDOMDocument2_Release(doc);