msxml3: Implemented xmlnode_get_nodeTypedValue 'string' data type handling.
This commit is contained in:
parent
41f061ea1b
commit
b56031c3a6
|
@ -944,36 +944,62 @@ static HRESULT WINAPI xmlnode_get_definition(
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI xmlnode_get_dataType(IXMLDOMNode*, VARIANT*);
|
||||||
|
|
||||||
|
inline HRESULT VARIANT_from_xmlChar(xmlChar *str, VARIANT *v, BSTR type)
|
||||||
|
{
|
||||||
|
if(!type || !lstrcmpiW(type, szString))
|
||||||
|
{
|
||||||
|
V_VT(v) = VT_BSTR;
|
||||||
|
V_BSTR(v) = bstr_from_xmlChar(str);
|
||||||
|
|
||||||
|
if(!V_BSTR(v))
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FIXME("Type handling not yet implemented\n");
|
||||||
|
V_VT(v) = VT_BSTR;
|
||||||
|
V_BSTR(v) = bstr_from_xmlChar(str);
|
||||||
|
|
||||||
|
if(!V_BSTR(v))
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI xmlnode_get_nodeTypedValue(
|
static HRESULT WINAPI xmlnode_get_nodeTypedValue(
|
||||||
IXMLDOMNode *iface,
|
IXMLDOMNode *iface,
|
||||||
VARIANT* typedValue)
|
VARIANT* typedValue)
|
||||||
{
|
{
|
||||||
xmlnode *This = impl_from_IXMLDOMNode( iface );
|
xmlnode *This = impl_from_IXMLDOMNode( iface );
|
||||||
HRESULT r = S_FALSE;
|
VARIANT type;
|
||||||
|
xmlChar *content;
|
||||||
|
HRESULT hres = S_FALSE;
|
||||||
|
|
||||||
FIXME("ignoring data type %p %p\n", This, typedValue);
|
TRACE("iface %p\n", iface);
|
||||||
|
|
||||||
if(!typedValue)
|
if(!typedValue)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
V_VT(typedValue) = VT_NULL;
|
V_VT(typedValue) = VT_NULL;
|
||||||
|
|
||||||
switch ( This->node->type )
|
if(This->node->type == XML_ELEMENT_NODE ||
|
||||||
{
|
This->node->type == XML_TEXT_NODE ||
|
||||||
case XML_ELEMENT_NODE:
|
This->node->type == XML_ENTITY_REF_NODE)
|
||||||
{
|
hres = xmlnode_get_dataType(iface, &type);
|
||||||
xmlChar *content = xmlNodeGetContent(This->node);
|
|
||||||
V_VT(typedValue) = VT_BSTR;
|
|
||||||
V_BSTR(typedValue) = bstr_from_xmlChar( content );
|
|
||||||
xmlFree(content);
|
|
||||||
r = S_OK;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
r = xmlnode_get_nodeValue(iface, typedValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
if(hres != S_OK && This->node->type != XML_ELEMENT_NODE)
|
||||||
|
return xmlnode_get_nodeValue(iface, typedValue);
|
||||||
|
|
||||||
|
content = xmlNodeGetContent(This->node);
|
||||||
|
hres = VARIANT_from_xmlChar(content, typedValue,
|
||||||
|
hres==S_OK ? V_BSTR(&type) : NULL);
|
||||||
|
xmlFree(content);
|
||||||
|
VariantClear(&type);
|
||||||
|
|
||||||
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI xmlnode_put_nodeTypedValue(
|
static HRESULT WINAPI xmlnode_put_nodeTypedValue(
|
||||||
|
|
|
@ -147,8 +147,11 @@ static const CHAR szTransformOutput[] =
|
||||||
"</h1></body></html>";
|
"</h1></body></html>";
|
||||||
|
|
||||||
static const CHAR szTypeValueXML[] =
|
static const CHAR szTypeValueXML[] =
|
||||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
||||||
"<string>Wine</string>";
|
"<root xmlns:dt=\"urn:schemas-microsoft-com:datatypes\">\n"
|
||||||
|
" <string>Wine</string>\n"
|
||||||
|
" <string2 dt:dt=\"string\">String</string2>\n"
|
||||||
|
"</root>";
|
||||||
|
|
||||||
static const CHAR szBasicTransformSSXMLPart1[] =
|
static const CHAR szBasicTransformSSXMLPart1[] =
|
||||||
"<?xml version=\"1.0\"?>"
|
"<?xml version=\"1.0\"?>"
|
||||||
|
@ -3972,7 +3975,7 @@ static void test_NodeTypeValue(void)
|
||||||
hr = IXMLDOMDocument2_get_nodeTypedValue(doc, &v);
|
hr = IXMLDOMDocument2_get_nodeTypedValue(doc, &v);
|
||||||
ok(hr == S_FALSE, "ret %08x\n", hr );
|
ok(hr == S_FALSE, "ret %08x\n", hr );
|
||||||
|
|
||||||
hr = IXMLDOMDocument2_selectSingleNode(doc, _bstr_("string"), &pNode);
|
hr = IXMLDOMDocument2_selectSingleNode(doc, _bstr_("root/string"), &pNode);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr );
|
ok(hr == S_OK, "ret %08x\n", hr );
|
||||||
if(hr == S_OK)
|
if(hr == S_OK)
|
||||||
{
|
{
|
||||||
|
@ -3987,11 +3990,25 @@ static void test_NodeTypeValue(void)
|
||||||
|
|
||||||
hr = IXMLDOMNode_get_nodeTypedValue(pNode, &v);
|
hr = IXMLDOMNode_get_nodeTypedValue(pNode, &v);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr );
|
ok(hr == S_OK, "ret %08x\n", hr );
|
||||||
|
ok(V_VT(&v) == VT_BSTR, "incorrect type\n");
|
||||||
ok(!lstrcmpW( V_BSTR(&v), _bstr_("Wine") ), "incorrect value\n");
|
ok(!lstrcmpW( V_BSTR(&v), _bstr_("Wine") ), "incorrect value\n");
|
||||||
VariantClear( &v );
|
VariantClear( &v );
|
||||||
|
|
||||||
IXMLDOMNode_Release(pNode);
|
IXMLDOMNode_Release(pNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr = IXMLDOMDocument2_selectSingleNode(doc, _bstr_("root/string2"), &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_BSTR, "incorrect type\n");
|
||||||
|
ok(!lstrcmpW( V_BSTR(&v), _bstr_("String") ), "incorrect value\n");
|
||||||
|
VariantClear( &v );
|
||||||
|
|
||||||
|
IXMLDOMNode_Release(pNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IXMLDOMDocument2_Release(doc);
|
IXMLDOMDocument2_Release(doc);
|
||||||
|
|
Loading…
Reference in New Issue