[Mono-bugs] [Bug 40266][Cri] New - No XPath.Context bound in XmlNode.SelectNodes

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 25 Mar 2003 13:25:34 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mathias.hasselmann@gmx.de.

http://bugzilla.ximian.com/show_bug.cgi?id=40266

--- shadow/40266	Tue Mar 25 13:25:34 2003
+++ shadow/40266.tmp.9033	Tue Mar 25 13:25:34 2003
@@ -0,0 +1,78 @@
+Bug#: 40266
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Critical
+Component: System.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathias.hasselmann@gmx.de               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: No XPath.Context bound in XmlNode.SelectNodes
+
+Don't know if this really is a bug, since I didn't come to check against
+.NET yet. But it appears line no XPath.Context bound in
+XmlNode.SelectNodes. As a result no XPath functions are available for the
+XPath expressions passed to XmlNode.SelectNodes.
+
+
+Steps to reproduce the problem:
+
+using System;
+using System.Xml;
+
+class SelectNodesTest
+{
+    public static void Main()
+    {
+        XmlDocument xml = new XmlDocument();
+        xml.LoadXml("<root><node argument='foobar'/></root>");
+
+        foreach(XmlNode node in xml.SelectNodes
+            ("//node[substring(@argument, 1, 3) = 'foo']"))
+        {
+            Console.WriteLine("match: {0}", node);
+        }
+    }
+}
+
+Actual Results:
+
+[mathias@dali tmp]$mcs SelectNodesTest.cs && mono SelectNodesTest.exe
+Compilation succeeded
+EVALUATE, EVALUATE, EVALUATE
+third
+context: System.Xml.XPath.DefaultContext
+--- 1 ---
+--- 2 ---
+--- 3 ---
+--- 4 ---
+func:
+ 
+Unhandled Exception: System.Xml.XPath.XPathException: function :substring
+not found
+in <0x0021a> 00 System.Xml.XPath.ExprFunctionCall:GetReturnType
+(System.Xml.XPath.BaseIterator)
+in <0x00030> 00 System.Xml.XPath.EqualityExpr:Evaluate
+(System.Xml.XPath.BaseIterator)
+in <0x000a8> 00 System.Xml.XPath.PredicateIterator:MoveNext ()
+in <0x0007d> 00 System.Xml.XPath.SlashIterator:MoveNext ()
+in <0x00112> 00 System.Xml.XmlNode:SelectNodes
+(string,System.Xml.XmlNamespaceManager)
+in <0x00071> 00 .SelectNodesTest:Main ()
+
+Expected Results:
+
+[mathias@dali tmp]$mcs SelectNodesTest.cs && mono SelectNodesTest.exe
+Compilation succeeded
+match: System.Xml.XmlElement
+
+How often does this happen? 
+
+Always, as long computers are deterministic machines. ;-)