msxml3: Implement get_nodeTypeString.

This commit is contained in:
Alistair Leslie-Hughes 2008-01-16 16:47:19 +11:00 committed by Alexandre Julliard
parent b2101b8177
commit 055b5e44fe
2 changed files with 101 additions and 3 deletions

View File

@ -646,8 +646,63 @@ static HRESULT WINAPI xmlnode_get_nodeTypeString(
IXMLDOMNode *iface,
BSTR* xmlnodeType)
{
FIXME("\n");
return E_NOTIMPL;
xmlnode *This = impl_from_IXMLDOMNode( iface );
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(

View File

@ -550,6 +550,12 @@ static void test_domdoc( void )
ok( V_VT(&var) == VT_NULL, "incorrect dataType type\n");
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 );
}
SysFreeString( str );
@ -569,7 +575,8 @@ static void test_domdoc( void )
r = IXMLDOMComment_get_lastChild(node_comment, &nodeChild);
ok(r == S_FALSE, "ret %08x\n", r );
ok(nodeChild == NULL, "pLastChild not NULL\n");
IXMLDOMText_Release( node_comment );
IXMLDOMComment_Release( node_comment );
}
/* test Create Attribute */
@ -607,6 +614,12 @@ static void test_domdoc( void )
ok( V_VT(&var) == VT_NULL, "incorrect dataType type\n");
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);
}
@ -1898,6 +1911,12 @@ static void test_xmlTypes(void)
ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n");
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);
ok(hr == S_OK, "ret %08x\n", hr );
if(hr == S_OK)
@ -1920,6 +1939,12 @@ static void test_xmlTypes(void)
ok(hr == S_FALSE, "ret %08x\n", hr );
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);
ok(hr == S_OK, "ret %08x\n", hr );
@ -1949,6 +1974,12 @@ static void test_xmlTypes(void)
hr = IXMLDOMElement_appendChild(pRoot, (IXMLDOMNode*)pElement, NULL);
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);
ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, szElement ), "incorrect element node Name\n");
@ -2016,6 +2047,12 @@ static void test_xmlTypes(void)
ok( !lstrcmpW( str, szAttribute ), "incorrect attribute node Name\n");
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);
ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, szAttributeXML ), "incorrect attribute xml\n");
@ -2092,6 +2129,12 @@ static void test_xmlTypes(void)
ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n");
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);
}