Author: atsushi
Date: 2007-01-05 11:20:04 -0500 (Fri, 05 Jan 2007)
New Revision: 70536
Modified:
trunk/mcs/class/System.XML/System.Xml.XPath/ChangeLog
trunk/mcs/class/System.XML/System.Xml.XPath/Expression.cs
trunk/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog
trunk/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs
Log:
2007-01-05 Atsushi Enomoto <[EMAIL PROTECTED]>
* Expression.cs : text() should match whitespace and significant
whitespace nodes.
* XPathNavigatorTests.cs : added test for text() and whitespace/
significantwhitespace node.
Modified: trunk/mcs/class/System.XML/System.Xml.XPath/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.XPath/ChangeLog 2007-01-05
15:56:18 UTC (rev 70535)
+++ trunk/mcs/class/System.XML/System.Xml.XPath/ChangeLog 2007-01-05
16:20:04 UTC (rev 70536)
@@ -1,3 +1,8 @@
+2007-01-05 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * Expression.cs : text() should match whitespace and significant
+ whitespace nodes.
+
2006-11-10 Atsushi Enomoto <[EMAIL PROTECTED]>
* XPathNavigator.cs :
Modified: trunk/mcs/class/System.XML/System.Xml.XPath/Expression.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.XPath/Expression.cs 2007-01-05
15:56:18 UTC (rev 70535)
+++ trunk/mcs/class/System.XML/System.Xml.XPath/Expression.cs 2007-01-05
16:20:04 UTC (rev 70536)
@@ -1560,9 +1560,14 @@
return true;
case XPathNodeType.Text:
- if (nodeType ==
XPathNodeType.SignificantWhitespace)
+ switch (nodeType) {
+ case XPathNodeType.Text:
+ case XPathNodeType.Whitespace:
+ case
XPathNodeType.SignificantWhitespace:
return true;
- goto default;
+ default:
+ return false;
+ }
default:
return type == nodeType;
}
Modified: trunk/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog 2007-01-05
15:56:18 UTC (rev 70535)
+++ trunk/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog 2007-01-05
16:20:04 UTC (rev 70536)
@@ -1,3 +1,8 @@
+2007-01-05 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XPathNavigatorTests.cs : added test for text() and whitespace/
+ significantwhitespace node.
+
2006-12-05 Atsushi Enomoto <[EMAIL PROTECTED]>
* XPathNavigatorReaderTests.cs : added test for MoveToAttribute(int).
Modified:
trunk/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs
2007-01-05 15:56:18 UTC (rev 70535)
+++ trunk/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs
2007-01-05 16:20:04 UTC (rev 70536)
@@ -409,6 +409,24 @@
}
}
+ [Test]
+ public void TextMatchesWhitespace ()
+ {
+ string xml = "<root><ws> </ws><sws
xml:space='preserve'> </sws></root>";
+ XmlDocument doc = new XmlDocument ();
+ doc.PreserveWhitespace = true;
+ doc.LoadXml (xml);
+ XPathNavigator nav = doc.CreateNavigator ();
+ nav.MoveToFirstChild (); // root
+ nav.MoveToFirstChild (); // ws
+ nav.MoveToFirstChild (); // ' '
+ AssertEquals ("#1", true, nav.Matches ("text()"));
+ nav.MoveToParent ();
+ nav.MoveToNext (); // sws
+ nav.MoveToFirstChild (); // ' '
+ AssertEquals ("#2", true, nav.Matches ("text()"));
+ }
+
#if NET_2_0
[Test]
public void ValueAsBoolean ()
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches