[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         |   24 +++++++++++++++++++++++-
 dlls/msxml3/tests/domdoc.c |   23 ++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index a04e014..e745b24 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -421,7 +421,29 @@ 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_COMMENT_NODE:
+    case XML_DOCUMENT_NODE:
+    case XML_DOCUMENT_FRAG_NODE:
+    case XML_ENTITY_NODE:
+    case XML_TEXT_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..8905fa9 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -568,7 +568,15 @@ 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");
+    
+    map = (IXMLDOMNamedNodeMap*)0x1;
+    r = IXMLDOMAttribute_get_attributes( doc, &map);
+    ok( r == S_FALSE, "get_attributes returned wrong code\n");
+    ok( map == NULL, "map not NULL\n");
+    
     b = FALSE;
     str = SysAllocString( szComplete4 );
     r = IXMLDOMDocument_loadXML( doc, str, &b );
@@ -651,6 +659,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 +1835,11 @@ 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 %08x\n", hr);
+                ok(pAttribs == NULL, "pAttribs not NULL");
+                
                 hr = IXMLDOMElement_appendChild(pRoot, (IXMLDOMNode*)pComment, NULL);
                 ok(hr == S_OK, "ret %08x\n", hr );
 
@@ -1873,6 +1889,11 @@ 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");
+                    ok(pAttribs == NULL, "pAttribs not NULL");
 
                     hr = IXMLDOMAttribute_get_nextSibling(pAttrubute, NULL);
                     ok(hr == E_INVALIDARG, "ret %08x\n", hr );
-- 
1.5.3.7


--------------060503030200020207070209--




More information about the wine-patches mailing list