Alistair Leslie-Hughes : msxml3: get_attributes not supported for Attribute , CData, Comment, Doc, Doc Frag, Entity and Text Nodes.

Alexandre Julliard julliard at winehq.org
Wed Jan 9 07:02:09 CST 2008


Module: wine
Branch: master
Commit: e906b136eb17eb42b42313fd5ffd575c870cabcd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e906b136eb17eb42b42313fd5ffd575c870cabcd

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Tue Jan  8 12:43:34 2008 +1100

msxml3: get_attributes not supported for Attribute, CData, Comment, Doc, Doc Frag, Entity and Text Nodes.

---

 dlls/msxml3/node.c         |   22 ++++++++++++++++++++--
 dlls/msxml3/tests/domdoc.c |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index 03d96f5..2a93ab8 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -408,8 +408,26 @@ static HRESULT WINAPI xmlnode_get_attributes(
 {
     xmlnode *This = impl_from_IXMLDOMNode( iface );
     TRACE("%p\n", This);
-    *attributeMap = create_nodemap( iface );
-    return S_OK;
+
+    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;
+    default:
+        *attributeMap = create_nodemap( iface );
+        return S_OK;
+    }
 }
 
 static HRESULT WINAPI xmlnode_insertBefore(
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 3418ebb..3038858 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -512,6 +512,8 @@ static void test_domdoc( void )
     ok( r == S_OK, "returns %08x\n", r );
     if(nodetext)
     {
+        IXMLDOMNamedNodeMap *pAttribs;
+
         /* Text Last Child Checks */
         r = IXMLDOMText_get_lastChild(nodetext, NULL);
         ok(r == E_INVALIDARG, "ret %08x\n", r );
@@ -520,6 +522,15 @@ static void test_domdoc( void )
         r = IXMLDOMText_get_lastChild(nodetext, &nodeChild);
         ok(r == S_FALSE, "ret %08x\n", r );
         ok(nodeChild == NULL, "nodeChild not NULL\n");
+
+        /* test get_attributes */
+        r = IXMLDOMText_get_attributes( nodetext, NULL );
+        ok( r == E_INVALIDARG, "get_attributes returned wrong code\n");
+
+        pAttribs = (IXMLDOMNamedNodeMap*)0x1;
+        r = IXMLDOMText_get_attributes( nodetext, &pAttribs);
+        ok(r == S_FALSE, "ret %08x\n", r );
+        ok( pAttribs == NULL, "pAttribs not NULL\n");
     }
     IXMLDOMText_Release( nodetext );
     SysFreeString( str );
@@ -1838,6 +1849,15 @@ static void test_xmlTypes(void)
     ok(hr == S_FALSE, "ret %08x\n", hr );
     ok(pNextChild == NULL, "pNextChild not NULL\n");
 
+    /* test get_attributes */
+    hr = IXMLDOMDocument_get_attributes( doc, NULL );
+    ok( hr == E_INVALIDARG, "get_attributes returned wrong code\n");
+
+    pAttribs = (IXMLDOMNamedNodeMap*)0x1;
+    hr = IXMLDOMDocument_get_attributes( doc, &pAttribs);
+    ok(hr == S_FALSE, "ret %08x\n", hr );
+    ok( pAttribs == NULL, "pAttribs not NULL\n");
+
     hr = IXMLDOMDocument_createElement(doc, _bstr_("Testing"), &pRoot);
     ok(hr == S_OK, "ret %08x\n", hr );
     if(hr == S_OK)
@@ -1851,6 +1871,15 @@ static void test_xmlTypes(void)
             ok(hr == S_OK, "ret %08x\n", hr );
             if(hr == S_OK)
             {
+                /* test get_attributes */
+                hr = IXMLDOMComment_get_attributes( pComment, NULL );
+                ok( hr == E_INVALIDARG, "get_attributes returned wrong code\n");
+
+                pAttribs = (IXMLDOMNamedNodeMap*)0x1;
+                hr = IXMLDOMComment_get_attributes( pComment, &pAttribs);
+                ok(hr == S_FALSE, "ret %08x\n", hr );
+                ok( pAttribs == NULL, "pAttribs not NULL\n");
+
                 hr = IXMLDOMElement_appendChild(pRoot, (IXMLDOMNode*)pComment, NULL);
                 ok(hr == S_OK, "ret %08x\n", hr );
 
@@ -1909,6 +1938,15 @@ static void test_xmlTypes(void)
                     ok(hr == S_FALSE, "ret %08x\n", hr );
                     ok(pNextChild == NULL, "pNextChild not NULL\n");
 
+                    /* test get_attributes */
+                    hr = IXMLDOMAttribute_get_attributes( pAttrubute, NULL );
+                    ok( hr == E_INVALIDARG, "get_attributes returned wrong code\n");
+
+                    pAttribs = (IXMLDOMNamedNodeMap*)0x1;
+                    hr = IXMLDOMAttribute_get_attributes( pAttrubute, &pAttribs);
+                    ok(hr == S_FALSE, "ret %08x\n", hr );
+                    ok( pAttribs == NULL, "pAttribs not NULL\n");
+
                     hr = IXMLDOMElement_appendChild(pElement, (IXMLDOMNode*)pAttrubute, &pNewChild);
                     ok(hr == E_FAIL, "ret %08x\n", hr );
                     ok(pNewChild == NULL, "pNewChild not NULL\n");




More information about the wine-cvs mailing list