Author: rfm
Date: Thu Mar 20 07:33:44 2014
New Revision: 37759

URL: http://svn.gna.org/viewcvs/gnustep?rev=37759&view=rev
Log:
allow traversal of all nodes in tree using -nextElement:

Modified:
    libs/webservices/trunk/ChangeLog
    libs/webservices/trunk/GWSElement.h
    libs/webservices/trunk/GWSElement.m

Modified: libs/webservices/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/webservices/trunk/ChangeLog?rev=37759&r1=37758&r2=37759&view=diff
==============================================================================
--- libs/webservices/trunk/ChangeLog    (original)
+++ libs/webservices/trunk/ChangeLog    Thu Mar 20 07:33:44 2014
@@ -1,3 +1,10 @@
+2014-03-20 Richard Frith-Macdonald  <[email protected]>
+
+       GWSElement.h:
+       GWSElement.m:
+       Change -nextElement: to traverse all nodes in tree if the requested
+       element name is nil.
+
 2014-01-31 Richard Frith-Macdonald  <[email protected]>
 
         * configure.ac: check for gnutls hash function

Modified: libs/webservices/trunk/GWSElement.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/webservices/trunk/GWSElement.h?rev=37759&r1=37758&r2=37759&view=diff
==============================================================================
--- libs/webservices/trunk/GWSElement.h (original)
+++ libs/webservices/trunk/GWSElement.h Thu Mar 20 07:33:44 2014
@@ -280,7 +280,9 @@
 /** Searches the tree for the next element with the specified name (ignoring
  * any namespace prefix).  Children of the receiver are searched first,
  * then siblings of the receiver's parent, then siblings of the parent's
- * parent and so on.
+ * parent and so on.<br />
+ * If the supplied name is nil, any element matches, so this method may be
+ * used to traverse the entire tree passing through all nodes.
  */
 - (GWSElement*) nextElement: (NSString*)name;
 

Modified: libs/webservices/trunk/GWSElement.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/webservices/trunk/GWSElement.m?rev=37759&r1=37758&r2=37759&view=diff
==============================================================================
--- libs/webservices/trunk/GWSElement.m (original)
+++ libs/webservices/trunk/GWSElement.m Thu Mar 20 07:33:44 2014
@@ -801,8 +801,9 @@
 
   while (count-- > 0)
     {
-      GWSElement       *found = [elem findElement: name];
-
+      GWSElement       *found;
+
+      found = (nil == name) ? elem : [elem findElement: name];
       if (found != nil)
        {
          return found;
@@ -812,8 +813,9 @@
   elem = [self sibling];
   while (elem != nil)
     {
-      GWSElement       *found = [elem findElement: name];
-
+      GWSElement       *found;
+
+      found = (nil == name) ? elem : [elem findElement: name];
       if (found != nil)
        {
          return found;
@@ -826,8 +828,9 @@
       elem = [up sibling];
       while (elem != nil)
        {
-         GWSElement    *found = [elem findElement: name];
-
+         GWSElement    *found;
+
+          found = (nil == name) ? elem : [elem findElement: name];
          if (found != nil)
            {
              return found;


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to