Resend: msxml.dll: nextNode and reset functions

Colin Pitrat colin.pitrat at bull.net
Thu Dec 28 09:22:31 CST 2006


Hi,

here is a patch I sent a few weeks ago implementing two functions in 
msxml.dll, and the corresponding test.

Colin Pitrat (Bull Services Telco)
Bull,  Architect of an Open World (TM)
Tél : +33 (0)  1 30 80 72 93
www.bull.com
-------------- next part --------------
diff --git a/dlls/msxml3/nodemap.c b/dlls/msxml3/nodemap.c
index 0797436..a57ce82 100644
--- a/dlls/msxml3/nodemap.c
+++ b/dlls/msxml3/nodemap.c
@@ -44,6 +44,7 @@ typedef struct _xmlnodemap
     const struct ISupportErrorInfoVtbl *lpSEIVtbl;
     LONG ref;
     IXMLDOMNode *node;
+    long iterator;
 } xmlnodemap;
 
 static inline xmlnodemap *impl_from_IXMLDOMNamedNodeMap( IXMLDOMNamedNodeMap *iface )
@@ -297,15 +298,42 @@ static HRESULT WINAPI xmlnodemap_nextNode(
     IXMLDOMNamedNodeMap *iface,
     IXMLDOMNode** nextItem)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
+    xmlNodePtr node;
+    xmlAttrPtr curr;
+    long attrIndex;
+
+    TRACE("%p %ld\n", This, This->iterator);
+
+    *nextItem = NULL;
+
+    node = xmlNodePtr_from_domnode( This->node, 0 );
+    curr = node->properties;
+
+    for (attrIndex = 0; attrIndex < This->iterator; attrIndex++) {
+        if (curr->next == NULL)
+            return S_FALSE;
+        else
+            curr = curr->next;
+    }
+
+    This->iterator++;
+    
+    *nextItem = create_node( (xmlNodePtr) curr );
+
+    return S_OK;
 }
 
 static HRESULT WINAPI xmlnodemap_reset(
     IXMLDOMNamedNodeMap *iface )
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
+
+    TRACE("%p %ld\n", This, This->iterator);
+
+    This->iterator = 0;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI xmlnodemap__newEnum(
@@ -389,6 +417,7 @@ IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node )
     nodemap->lpSEIVtbl = &support_error_vtbl;
     nodemap->node = node;
     nodemap->ref = 1;
+    nodemap->iterator = 0;
 
     IXMLDOMNode_AddRef( node );
     /* Since we AddRef a node here, we don't need to call xmldoc_add_ref() */
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 4fc139d..ef660ee 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -442,6 +442,23 @@ todo_wine
         ok ( str != NULL, "str is null\n");
         ok( !lstrcmpW( str, szdl ), "incorrect node name\n");
         SysFreeString( str );
+
+        /* test sequential access of attributes */
+        node = NULL;
+        r = IXMLDOMNamedNodeMap_nextNode( map, &node );
+        ok ( r == S_OK, "nextNode (first time) wrong code\n");
+        ok ( node != NULL, "nextNode, should be attribute\n");
+
+        r = IXMLDOMNamedNodeMap_nextNode( map, &node );
+        ok ( r != S_OK, "nextNode (second time) wrong code\n");
+        ok ( node == NULL, "nextNode, there is no attribute\n");
+
+        r = IXMLDOMNamedNodeMap_reset( map );
+        ok ( r == S_OK, "reset should return S_OK\n");
+
+        r = IXMLDOMNamedNodeMap_nextNode( map, &node );
+        ok ( r == S_OK, "nextNode (third time) wrong code\n");
+        ok ( node != NULL, "nextNode, should be attribute\n");
     }
     else
         ok( FALSE, "no map\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: colin.pitrat.vcf
Type: text/x-vcard
Size: 247 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20061228/ac959239/colin.pitrat.vcf


More information about the wine-patches mailing list