[Mono-bugs] [Bug 75609][Maj] New - There is an issue with using
XPathNavigator
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Jul 22 11:14:25 EDT 2005
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 niraj.mehta at impact-tech.com.
http://bugzilla.ximian.com/show_bug.cgi?id=75609
--- shadow/75609 2005-07-22 11:14:25.000000000 -0400
+++ shadow/75609.tmp.29519 2005-07-22 11:14:25.000000000 -0400
@@ -0,0 +1,127 @@
+Bug#: 75609
+Product: Mono: Class Libraries
+Version: 1.0
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: Sys.XML
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: niraj.mehta at impact-tech.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: There is an issue with using XPathNavigator
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+Hi,
+I was working on a project on Mono when I came across an Issue.
+I am posting the piece of code that I was working on to solve this issue.
+
+using System;
+using System.Xml;
+using System.Xml.XPath;
+
+
+namespace XpathTest
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ class Class1
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ string ns = "http://mynamespace.com";
+ string strXmlDoc =
+ @"<Person xmlns:ns='"+ns+@"'>
+ <FirstName>John</FirstName>
+ <ns:LastName>Doe</ns:LastName>
+ </Person>";
+ XmlDocument xmlDoc = new XmlDocument();
+ xmlDoc.LoadXml(strXmlDoc);
+
+ // SelectChildren works with a null name space in
+ASP.net and Mono
+ XPathNavigator nav =
+xmlDoc.DocumentElement.CreateNavigator();
+ XPathNodeIterator iterWorks = nav.SelectChildren
+("FirstName","");
+
+ if (iterWorks.MoveNext())
+ {
+ Console.WriteLine("A null namespace works
+in using SelectChildren.");
+ Console.WriteLine("FirstName = " +
+iterWorks.Current.Value);
+ }
+ else
+ {
+ Console.WriteLine("FirstName not found");
+ }
+ // end SelectChildren working
+
+ Console.WriteLine();
+
+ // SelectChildren works in ASP.net with a
+namespace, but not in Mono
+ XPathNodeIterator iterFails = nav.SelectChildren
+("LastName",ns);
+ if (iterFails.MoveNext())
+ {
+ Console.WriteLine("A specified namespace
+works using SelectChildren.");
+ Console.WriteLine("LastName = " +
+iterFails.Current.Value);
+ }
+ else
+ {
+ Console.WriteLine("A specified namespace
+fails using SelectChildren.");
+ Console.WriteLine("LastName not found");
+ }
+ // end SelectChildren not working
+
+ Console.ReadLine();
+ }
+ }
+}
+
+
+
+
+Steps to reproduce the problem:
+1. Compile the code in Mono
+2. Run the exe.
+3.
+
+Actual Results:
+A null namespace works in using SelectChildren.
+FirstName = John
+
+A specified namespace fails using SelectChildren.
+LastName not found
+
+Expected Results:
+A null namespace works in using SelectChildren.
+FirstName = John
+A specified namespace works using SelectChildren.
+LastName = Doe.
+
+
+
+How often does this happen? EveryTime
+
+
+Additional Information:
+The same code run on .Net yields Expected Result.
+But using Mono yields the actual result.
More information about the mono-bugs
mailing list