Alistair Leslie-Hughes : msxml3: Add support to get_nodeTypedValue on Element Nodes.
Alexandre Julliard
julliard at winehq.org
Tue Oct 28 10:02:26 CDT 2008
Module: wine
Branch: master
Commit: 13606ed49d40174935135a053426f1f1ca7c9dc5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=13606ed49d40174935135a053426f1f1ca7c9dc5
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Tue Oct 28 19:47:15 2008 +1100
msxml3: Add support to get_nodeTypedValue on Element Nodes.
---
dlls/msxml3/node.c | 28 ++++++++++++++++++-
dlls/msxml3/tests/domdoc.c | 63 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 89 insertions(+), 2 deletions(-)
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index 63aa8df..3162f82 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -977,8 +977,32 @@ static HRESULT WINAPI xmlnode_get_nodeTypedValue(
IXMLDOMNode *iface,
VARIANT* typedValue)
{
- FIXME("ignoring data type\n");
- return xmlnode_get_nodeValue(iface, typedValue);
+ xmlnode *This = impl_from_IXMLDOMNode( iface );
+ HRESULT r = S_FALSE;
+
+ FIXME("ignoring data type %p %p\n", This, typedValue);
+
+ if(!typedValue)
+ return E_INVALIDARG;
+
+ V_VT(typedValue) = VT_NULL;
+
+ switch ( This->node->type )
+ {
+ case XML_ELEMENT_NODE:
+ {
+ 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;
}
static HRESULT WINAPI xmlnode_put_nodeTypedValue(
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 578738f..df3fa0e 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -146,6 +146,10 @@ static const CHAR szTransformOutput[] =
"Hello World"
"</h1></body></html>";
+static const CHAR szTypeValueXML[] =
+"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+"<string>Wine</string>";
+
static const WCHAR szNonExistentFile[] = {
'c', ':', '\\', 'N', 'o', 'n', 'e', 'x', 'i', 's', 't', 'e', 'n', 't', '.', 'x', 'm', 'l', 0
};
@@ -3782,6 +3786,64 @@ static void test_FormattingXML(void)
free_bstrs();
}
+static void test_NodeTypeValue(void)
+{
+ IXMLDOMDocument2 *doc = NULL;
+ IXMLDOMNode *pNode;
+ VARIANT_BOOL bSucc;
+ HRESULT hr;
+ VARIANT v;
+
+ hr = CoCreateInstance( &CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument2, (LPVOID*)&doc );
+ if( hr != S_OK )
+ return;
+
+ hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szTypeValueXML), &bSucc);
+ ok(hr == S_OK, "ret %08x\n", hr );
+ ok(bSucc == VARIANT_TRUE, "Expected VARIANT_TRUE got VARIANT_FALSE\n");
+ if(bSucc == VARIANT_TRUE)
+ {
+ hr = IXMLDOMDocument2_get_nodeValue(doc, NULL);
+ ok(hr == E_INVALIDARG, "ret %08x\n", hr );
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = NULL;
+ hr = IXMLDOMDocument2_get_nodeValue(doc, &v);
+ ok(hr == S_FALSE, "ret %08x\n", hr );
+ ok(V_VT(&v) == VT_NULL, "expect VT_NULL got %d\n", V_VT(&v));
+
+ hr = IXMLDOMDocument2_get_nodeTypedValue(doc, NULL);
+ ok(hr == E_INVALIDARG, "ret %08x\n", hr );
+
+ hr = IXMLDOMDocument2_get_nodeTypedValue(doc, &v);
+ ok(hr == S_FALSE, "ret %08x\n", hr );
+
+ hr = IXMLDOMDocument2_selectSingleNode(doc, _bstr_("string"), &pNode);
+ ok(hr == S_OK, "ret %08x\n", hr );
+ if(hr == S_OK)
+ {
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = NULL;
+ hr = IXMLDOMNode_get_nodeValue(pNode, &v);
+ ok(hr == S_FALSE, "ret %08x\n", hr );
+ ok(V_VT(&v) == VT_NULL, "expect VT_NULL got %d\n", V_VT(&v));
+
+ hr = IXMLDOMNode_get_nodeTypedValue(pNode, NULL);
+ ok(hr == E_INVALIDARG, "ret %08x\n", hr );
+
+ hr = IXMLDOMNode_get_nodeTypedValue(pNode, &v);
+ ok(hr == S_OK, "ret %08x\n", hr );
+ ok(!lstrcmpW( V_BSTR(&v), _bstr_("Wine") ), "incorrect value\n");
+
+ IXMLDOMNode_Release(pNode);
+ }
+ }
+
+ IXMLDOMDocument2_Release(doc);
+
+ free_bstrs();
+}
+
START_TEST(domdoc)
{
HRESULT r;
@@ -3810,6 +3872,7 @@ START_TEST(domdoc)
test_testTransforms();
test_Namespaces();
test_FormattingXML();
+ test_NodeTypeValue();
CoUninitialize();
}
More information about the wine-cvs
mailing list