[PATCH] get_attributes not support on the Attributes, Comment, Document, Text Nodes
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Sun Jan 6 22:20:32 CST 2008
---
dlls/msxml3/node.c | 21 ++++++++++++++++++++-
dlls/msxml3/tests/domdoc.c | 14 ++++++++++++++
2 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index a04e014..1a78929 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -421,7 +421,26 @@ static HRESULT WINAPI xmlnode_get_attributes(
IXMLDOMNamedNodeMap** attributeMap)
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
- TRACE("%p\n", This);
+ TRACE("%p\n", This );
+
+ if (!attributeMap)
+ return E_INVALIDARG;
+
+ switch( This->node->type )
+ {
+ /* Attribute, CDataSection, Comment, Documents, Documents Fragments, Entity,
+ and Text nodes does not support get_attributes */
+ case XML_ATTRIBUTE_NODE:
+ case XML_DOCUMENT_NODE:
+ case XML_DOCUMENT_FRAG_NODE:
+ *attributeMap = NULL;
+
+ return S_FALSE;
+ break;
+ default:
+ break;
+ }
+
*attributeMap = create_nodemap( iface );
return S_OK;
}
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 148f29c..38c9c82 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -568,6 +568,9 @@ static void test_domnode( void )
CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc );
if( r != S_OK )
return;
+
+ r = IXMLDOMDocument_get_attributes( doc, NULL );
+ ok( r == E_INVALIDARG, "get_attributes returned wrong code\n");
b = FALSE;
str = SysAllocString( szComplete4 );
@@ -651,6 +654,9 @@ static void test_domnode( void )
ok( !lstrcmpW(V_BSTR(&var), szstr1), "wrong attr value\n");
VariantClear( &var );
SysFreeString( str );
+
+ r = IXMLDOMElement_get_attributes( element, NULL );
+ ok( r == E_INVALIDARG, "get_attributes returned wrong code\n");
r = IXMLDOMElement_get_attributes( element, &map );
ok( r == S_OK, "get_attributes returned wrong code\n");
@@ -1824,6 +1830,10 @@ static void test_xmlTypes(void)
{
IXMLDOMNode *pLastChild = (IXMLDOMNode*)0x1;
+ pAttribs = (IXMLDOMNamedNodeMap*)0x1;
+ hr = IXMLDOMComment_get_attributes( pComment, &pAttribs);
+ ok( hr == S_FALSE, "get_attributes returned wrong code\n");
+
hr = IXMLDOMElement_appendChild(pRoot, (IXMLDOMNode*)pComment, NULL);
ok(hr == S_OK, "ret %08x\n", hr );
@@ -1873,6 +1883,10 @@ static void test_xmlTypes(void)
{
IXMLDOMNode *pNextChild = (IXMLDOMNode *)0x1;
IXMLDOMNode *pNewChild = (IXMLDOMNode *)0x1;
+
+ pAttribs = (IXMLDOMNamedNodeMap*)0x1;
+ hr = IXMLDOMAttribute_get_attributes( doc, &pAttribs);
+ ok( hr == S_FALSE, "get_attributes returned wrong code\n");
hr = IXMLDOMAttribute_get_nextSibling(pAttrubute, NULL);
ok(hr == E_INVALIDARG, "ret %08x\n", hr );
--
1.5.3.7
--------------050305050304030705000004--
More information about the wine-patches
mailing list