Author: atsushi
Date: 2005-03-14 13:09:51 -0500 (Mon, 14 Mar 2005)
New Revision: 41801

Modified:
   trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
   trunk/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs
Log:
2004-03-14  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * DTMXPathNavigator2.cs : Eliminating Depth. (To completely eliminate,
          we also have to eliminate them from builder and writer).



Modified: trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog 2005-03-14 16:36:07 UTC 
(rev 41800)
+++ trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog 2005-03-14 18:09:51 UTC 
(rev 41801)
@@ -1,3 +1,8 @@
+2004-03-14  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * DTMXPathNavigator2.cs : Eliminating Depth. (To completely eliminate,
+         we also have to eliminate them from builder and writer).
+
 2004-03-07  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * DTMXPathDocumentBuilder2.cs : When there was an empty element and

Modified: trunk/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs     
2005-03-14 16:36:07 UTC (rev 41800)
+++ trunk/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs     
2005-03-14 18:09:51 UTC (rev 41801)
@@ -233,15 +233,27 @@
                                        valueBuilder = new StringBuilder ();
                                else
                                        valueBuilder.Length = 0;
-                               
+
+                               int end = nodes [currentNode].NextSibling;
+                               if (end == 0) {
+                                       int tmp = currentNode;
+                                       do {
+                                               tmp = nodes [tmp].Parent;
+                                               end = nodes [tmp].NextSibling;
+                                       } while (end == 0 && tmp != 0);
+                                       if (end == 0)
+                                               end = nodes.Length;
+                               }
+
                                int iter = nodes [currentNode].FirstChild;
-                               int depth = nodes [currentNode].Depth;
-                               while (iter < nodes.Length && nodes 
[iter].Depth > depth) {
+                               if (iter == 0)
+                                       iter = end;
+
+                               while (iter < end) {
                                        switch (nodes [iter].NodeType) {
-                                       case XPathNodeType.Comment:
-                                       case 
XPathNodeType.ProcessingInstruction:
-                                               break;
-                                       default:
+                                       case XPathNodeType.Text:
+                                       case 
XPathNodeType.SignificantWhitespace:
+                                       case XPathNodeType.Whitespace:
                                                valueBuilder.Append 
(nonAtomicStringPool [nodes [iter].Value]);
                                                break;
                                        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to