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

msxml3: Implement get_nodeTypeString.

parent b2101b81
...@@ -646,8 +646,63 @@ static HRESULT WINAPI xmlnode_get_nodeTypeString( ...@@ -646,8 +646,63 @@ static HRESULT WINAPI xmlnode_get_nodeTypeString(
IXMLDOMNode *iface, IXMLDOMNode *iface,
BSTR* xmlnodeType) BSTR* xmlnodeType)
{ {
FIXME("\n"); xmlnode *This = impl_from_IXMLDOMNode( iface );
return E_NOTIMPL; const xmlChar *str;
TRACE("%p\n", This );
if (!xmlnodeType)
return E_INVALIDARG;
if ( !This->node )
return E_FAIL;
switch( This->node->type )
{
case XML_ATTRIBUTE_NODE:
str = (const xmlChar*) "attribute";
break;
case XML_CDATA_SECTION_NODE:
str = (const xmlChar*) "cdatasection";
break;
case XML_COMMENT_NODE:
str = (const xmlChar*) "comment";
break;
case XML_DOCUMENT_NODE:
str = (const xmlChar*) "document";
break;
case XML_DOCUMENT_FRAG_NODE:
str = (const xmlChar*) "documentfragment";
break;
case XML_ELEMENT_NODE:
str = (const xmlChar*) "element";
break;
case XML_ENTITY_NODE:
str = (const xmlChar*) "entity";
break;
case XML_ENTITY_REF_NODE:
str = (const xmlChar*) "entityreference";
break;
case XML_NOTATION_NODE:
str = (const xmlChar*) "notation";
break;
case XML_PI_NODE:
str = (const xmlChar*) "processinginstruction";
break;
case XML_TEXT_NODE:
str = (const xmlChar*) "text";
break;
default:
FIXME("nodeName not mapped correctly (%d)\n", This->node->type);
str = This->node->name;
break;
}
*xmlnodeType = bstr_from_xmlChar( str );
if (!*xmlnodeType)
return S_FALSE;
return S_OK;
} }
static HRESULT WINAPI xmlnode_get_text( static HRESULT WINAPI xmlnode_get_text(
......
...@@ -550,6 +550,12 @@ static void test_domdoc( void ) ...@@ -550,6 +550,12 @@ static void test_domdoc( void )
ok( V_VT(&var) == VT_NULL, "incorrect dataType type\n"); ok( V_VT(&var) == VT_NULL, "incorrect dataType type\n");
VariantClear(&var); VariantClear(&var);
/* test nodeTypeString */
r = IXMLDOMText_get_nodeTypeString(nodetext, &str);
ok(r == S_OK, "ret %08x\n", r );
ok( !lstrcmpW( str, _bstr_("text") ), "incorrect nodeTypeString string\n");
SysFreeString(str);
IXMLDOMText_Release( nodetext ); IXMLDOMText_Release( nodetext );
} }
SysFreeString( str ); SysFreeString( str );
...@@ -569,7 +575,8 @@ static void test_domdoc( void ) ...@@ -569,7 +575,8 @@ static void test_domdoc( void )
r = IXMLDOMComment_get_lastChild(node_comment, &nodeChild); r = IXMLDOMComment_get_lastChild(node_comment, &nodeChild);
ok(r == S_FALSE, "ret %08x\n", r ); ok(r == S_FALSE, "ret %08x\n", r );
ok(nodeChild == NULL, "pLastChild not NULL\n"); ok(nodeChild == NULL, "pLastChild not NULL\n");
IXMLDOMText_Release( node_comment );
IXMLDOMComment_Release( node_comment );
} }
/* test Create Attribute */ /* test Create Attribute */
...@@ -607,6 +614,12 @@ static void test_domdoc( void ) ...@@ -607,6 +614,12 @@ static void test_domdoc( void )
ok( V_VT(&var) == VT_NULL, "incorrect dataType type\n"); ok( V_VT(&var) == VT_NULL, "incorrect dataType type\n");
VariantClear(&var); VariantClear(&var);
/* test nodeTypeString */
r = IXMLDOMProcessingInstruction_get_nodeTypeString(nodePI, &str);
ok(r == S_OK, "ret %08x\n", r );
ok( !lstrcmpW( str, _bstr_("processinginstruction") ), "incorrect nodeTypeString string\n");
SysFreeString(str);
IXMLDOMProcessingInstruction_Release(nodePI); IXMLDOMProcessingInstruction_Release(nodePI);
} }
...@@ -1898,6 +1911,12 @@ static void test_xmlTypes(void) ...@@ -1898,6 +1911,12 @@ static void test_xmlTypes(void)
ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n"); ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n");
VariantClear(&v); VariantClear(&v);
/* test nodeTypeString */
hr = IXMLDOMDocument_get_nodeTypeString(doc, &str);
ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, _bstr_("document") ), "incorrect nodeTypeString string\n");
SysFreeString(str);
hr = IXMLDOMDocument_createElement(doc, _bstr_("Testing"), &pRoot); hr = IXMLDOMDocument_createElement(doc, _bstr_("Testing"), &pRoot);
ok(hr == S_OK, "ret %08x\n", hr ); ok(hr == S_OK, "ret %08x\n", hr );
if(hr == S_OK) if(hr == S_OK)
...@@ -1920,6 +1939,12 @@ static void test_xmlTypes(void) ...@@ -1920,6 +1939,12 @@ static void test_xmlTypes(void)
ok(hr == S_FALSE, "ret %08x\n", hr ); ok(hr == S_FALSE, "ret %08x\n", hr );
ok( pAttribs == NULL, "pAttribs not NULL\n"); ok( pAttribs == NULL, "pAttribs not NULL\n");
/* test nodeTypeString */
hr = IXMLDOMComment_get_nodeTypeString(pComment, &str);
ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, _bstr_("comment") ), "incorrect nodeTypeString string\n");
SysFreeString(str);
hr = IXMLDOMElement_appendChild(pRoot, (IXMLDOMNode*)pComment, NULL); hr = IXMLDOMElement_appendChild(pRoot, (IXMLDOMNode*)pComment, NULL);
ok(hr == S_OK, "ret %08x\n", hr ); ok(hr == S_OK, "ret %08x\n", hr );
...@@ -1949,6 +1974,12 @@ static void test_xmlTypes(void) ...@@ -1949,6 +1974,12 @@ static void test_xmlTypes(void)
hr = IXMLDOMElement_appendChild(pRoot, (IXMLDOMNode*)pElement, NULL); hr = IXMLDOMElement_appendChild(pRoot, (IXMLDOMNode*)pElement, NULL);
ok(hr == S_OK, "ret %08x\n", hr ); ok(hr == S_OK, "ret %08x\n", hr );
/* test nodeTypeString */
hr = IXMLDOMDocument_get_nodeTypeString(pElement, &str);
ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, _bstr_("element") ), "incorrect nodeTypeString string\n");
SysFreeString(str);
hr = IXMLDOMElement_get_nodeName(pElement, &str); hr = IXMLDOMElement_get_nodeName(pElement, &str);
ok(hr == S_OK, "ret %08x\n", hr ); ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, szElement ), "incorrect element node Name\n"); ok( !lstrcmpW( str, szElement ), "incorrect element node Name\n");
...@@ -2016,6 +2047,12 @@ static void test_xmlTypes(void) ...@@ -2016,6 +2047,12 @@ static void test_xmlTypes(void)
ok( !lstrcmpW( str, szAttribute ), "incorrect attribute node Name\n"); ok( !lstrcmpW( str, szAttribute ), "incorrect attribute node Name\n");
SysFreeString(str); SysFreeString(str);
/* test nodeTypeString */
hr = IXMLDOMAttribute_get_nodeTypeString(pAttrubute, &str);
ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, _bstr_("attribute") ), "incorrect nodeTypeString string\n");
SysFreeString(str);
hr = IXMLDOMAttribute_get_xml(pAttrubute, &str); hr = IXMLDOMAttribute_get_xml(pAttrubute, &str);
ok(hr == S_OK, "ret %08x\n", hr ); ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, szAttributeXML ), "incorrect attribute xml\n"); ok( !lstrcmpW( str, szAttributeXML ), "incorrect attribute xml\n");
...@@ -2092,6 +2129,12 @@ static void test_xmlTypes(void) ...@@ -2092,6 +2129,12 @@ static void test_xmlTypes(void)
ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n"); ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n");
VariantClear(&v); VariantClear(&v);
/* test nodeTypeString */
hr = IXMLDOMCDATASection_get_nodeTypeString(pCDataSec, &str);
ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, _bstr_("cdatasection") ), "incorrect nodeTypeString string\n");
SysFreeString(str);
IXMLDOMCDATASection_Release(pCDataSec); IXMLDOMCDATASection_Release(pCDataSec);
} }
......
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