msxml.dll: nextNode and reset functions

Colin Pitrat colin.pitrat at bull.net
Thu Dec 14 04:41:25 CST 2006


Change Log:
	Add an iterator to _xmlnodemap struct
	Implement nextNode function that give nodes one by one
	Implement resetNode that reset the iterator

It's my first patch, so please tell me if something is wrong. I saw on 
http://www.winehq.com/site/sending_patches that I should write a test 
case, but I don't know how to do this (do I need windows ? because I 
don't have it).

-- 
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..ead0138 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,47 @@ static HRESULT WINAPI xmlnodemap_nextNod
     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;
+    }
+
+	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(
-------------- 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/20061214/905ecaa7/colin.pitrat.vcf


More information about the wine-patches mailing list