Commit e989d48f authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

msxml3: Implement get_dataType.

parent c3eda248
......@@ -736,8 +736,48 @@ static HRESULT WINAPI xmlnode_get_dataType(
IXMLDOMNode *iface,
VARIANT* dataTypeName)
{
FIXME("\n");
return E_NOTIMPL;
xmlnode *This = impl_from_IXMLDOMNode( iface );
xmlChar *pVal;
TRACE("iface %p\n", iface);
if(!dataTypeName)
return E_INVALIDARG;
/* CDATA Section, Comment, Document, Document Fragment,
Entity, Notation, PI, and Text Node are non-typed. */
V_BSTR(dataTypeName) = NULL;
V_VT(dataTypeName) = VT_NULL;
switch ( This->node->type )
{
case XML_ATTRIBUTE_NODE:
FIXME("NODE_ATTRIBUTE_NODE should return a valid value.\n");
break;
case XML_ELEMENT_NODE:
pVal = xmlGetNsProp(This->node, (xmlChar*)"dt",
(xmlChar*)"urn:schemas-microsoft-com:datatypes");
if (pVal)
{
V_VT(dataTypeName) = VT_BSTR;
V_BSTR(dataTypeName) = bstr_from_xmlChar( pVal );
xmlFree(pVal);
}
break;
case XML_ENTITY_REF_NODE:
FIXME("XML_ENTITY_REF_NODE should return a valid value.\n");
break;
default:
TRACE("Type %d returning NULL\n", This->node->type);
}
/* non-typed nodes return S_FALSE */
if(V_VT(dataTypeName) == VT_NULL)
{
return S_FALSE;
}
return S_OK;
}
static HRESULT WINAPI xmlnode_put_dataType(
......
......@@ -531,6 +531,13 @@ static void test_domdoc( void )
r = IXMLDOMText_get_attributes( nodetext, &pAttribs);
ok(r == S_FALSE, "ret %08x\n", r );
ok( pAttribs == NULL, "pAttribs not NULL\n");
/* test get_dataType */
r = IXMLDOMText_get_dataType(nodetext, &var);
ok(r == S_FALSE, "ret %08x\n", r );
ok( V_VT(&var) == VT_NULL, "incorrect dataType type\n");
VariantClear(&var);
IXMLDOMText_Release( nodetext );
}
SysFreeString( str );
......@@ -582,6 +589,12 @@ static void test_domdoc( void )
r = IXMLDOMProcessingInstruction_get_lastChild(nodePI, &nodeChild);
ok(r == S_FALSE, "ret %08x\n", r );
ok(nodeChild == NULL, "nodeChild not NULL\n");
r = IXMLDOMProcessingInstruction_get_dataType(nodePI, &var);
ok(r == S_FALSE, "ret %08x\n", r );
ok( V_VT(&var) == VT_NULL, "incorrect dataType type\n");
VariantClear(&var);
IXMLDOMProcessingInstruction_Release(nodePI);
}
......@@ -1828,6 +1841,7 @@ static void test_xmlTypes(void)
IXMLDOMNamedNodeMap *pAttribs;
BSTR str;
IXMLDOMNode *pNextChild = (IXMLDOMNode *)0x1; /* Used for testing Siblings */
VARIANT v;
hr = CoCreateInstance( &CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument2, (LPVOID*)&doc );
if( hr != S_OK )
......@@ -1858,6 +1872,12 @@ static void test_xmlTypes(void)
ok(hr == S_FALSE, "ret %08x\n", hr );
ok( pAttribs == NULL, "pAttribs not NULL\n");
/* test get_dataType */
hr = IXMLDOMDocument_get_dataType(doc, &v);
ok(hr == S_FALSE, "ret %08x\n", hr );
ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n");
VariantClear(&v);
hr = IXMLDOMDocument_createElement(doc, _bstr_("Testing"), &pRoot);
ok(hr == S_OK, "ret %08x\n", hr );
if(hr == S_OK)
......@@ -1893,6 +1913,11 @@ static void test_xmlTypes(void)
ok( !lstrcmpW( str, szCommentXML ), "incorrect comment xml\n");
SysFreeString(str);
hr = IXMLDOMComment_get_dataType(pComment, &v);
ok(hr == S_FALSE, "ret %08x\n", hr );
ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n");
VariantClear(&v);
IXMLDOMComment_Release(pComment);
}
......@@ -1914,6 +1939,11 @@ static void test_xmlTypes(void)
ok( !lstrcmpW( str, szElementXML ), "incorrect element xml\n");
SysFreeString(str);
hr = IXMLDOMElement_get_dataType(pElement, &v);
ok(hr == S_FALSE, "ret %08x\n", hr );
ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n");
VariantClear(&v);
/* Attribute */
hr = IXMLDOMDocument_createAttribute(doc, szAttribute, &pAttrubute);
ok(hr == S_OK, "ret %08x\n", hr );
......@@ -1971,6 +2001,11 @@ static void test_xmlTypes(void)
ok( !lstrcmpW( str, szAttributeXML ), "incorrect attribute xml\n");
SysFreeString(str);
hr = IXMLDOMAttribute_get_dataType(pAttrubute, &v);
ok(hr == S_FALSE, "ret %08x\n", hr );
ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n");
VariantClear(&v);
IXMLDOMAttribute_Release(pAttrubute);
/* Check Element again with the Add Attribute*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment