Author: atsushi
Date: 2008-02-11 22:27:03 -0500 (Mon, 11 Feb 2008)
New Revision: 95478

Modified:
   trunk/mcs/class/System.Xml.Linq/System.Xml.Linq/ChangeLog
   trunk/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
   trunk/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/ChangeLog
   trunk/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs
Log:
2008-02-12  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * XElement.cs : Value is rather a value in XPath semantics than
          the textual xml representation. Fixed bug #360858.

        * XElementTest.cs : added test for Value (bug #360858).



Modified: trunk/mcs/class/System.Xml.Linq/System.Xml.Linq/ChangeLog
===================================================================
--- trunk/mcs/class/System.Xml.Linq/System.Xml.Linq/ChangeLog   2008-02-12 
01:52:51 UTC (rev 95477)
+++ trunk/mcs/class/System.Xml.Linq/System.Xml.Linq/ChangeLog   2008-02-12 
03:27:03 UTC (rev 95478)
@@ -1,3 +1,8 @@
+2008-02-12  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * XElement.cs : Value is rather a value in XPath semantics than
+         the textual xml representation. Fixed bug #360858.
+
 2008-02-11  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * XNodeDocumentOrderComparer.cs : ancestor/descendant comparison was

Modified: trunk/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
===================================================================
--- trunk/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs 2008-02-12 
01:52:51 UTC (rev 95477)
+++ trunk/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs 2008-02-12 
03:27:03 UTC (rev 95478)
@@ -299,10 +299,13 @@
                public string Value {
                        get {
                                StringBuilder sb = null;
-                               foreach (object s in Nodes ()) {
+                               foreach (XNode n in Nodes ()) {
                                        if (sb == null)
                                                sb = new StringBuilder ();
-                                       sb.Append (s);
+                                       if (n is XText)
+                                               sb.Append (((XText) n).Value);
+                                       else if (n is XElement)
+                                               sb.Append (((XElement) 
n).Value);
                                }
                                return sb == null ? String.Empty : sb.ToString 
();
                        }

Modified: trunk/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/ChangeLog
===================================================================
--- trunk/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/ChangeLog      
2008-02-12 01:52:51 UTC (rev 95477)
+++ trunk/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/ChangeLog      
2008-02-12 03:27:03 UTC (rev 95478)
@@ -1,3 +1,7 @@
+2008-02-12  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * XElementTest.cs : added test for Value (bug #360858).
+
 2008-02-11  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * XNodeDocumentOrderComparerTest.cs : added another test for

Modified: trunk/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs
===================================================================
--- trunk/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs        
2008-02-12 01:52:51 UTC (rev 95477)
+++ trunk/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs        
2008-02-12 03:27:03 UTC (rev 95478)
@@ -357,5 +357,17 @@
                        Assert.AreEqual (null, (TimeSpan?) a, "TimeSpan?");
                        Assert.AreEqual (null, (string) a, "string");
                }
+
+               [Test]
+               public void Value ()
+               {
+                       // based on bug #360858
+                       XElement a = new XElement("root",
+                               new XElement ("foo"),
+                               "Linux&Windows",
+                               new XComment ("comment"),
+                               new XElement ("bar"));
+                       Assert.AreEqual ("Linux&Windows", a.Value);
+               }
        }
 }

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

Reply via email to