[Mono-bugs] [Bug 79874][Nor] New - XPath query, unable to select element node

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Nov 9 09:11:39 EST 2006


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 jankit at novell.com.

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

--- shadow/79874	2006-11-09 09:11:39.000000000 -0500
+++ shadow/79874.tmp.28552	2006-11-09 09:11:39.000000000 -0500
@@ -0,0 +1,70 @@
+Bug#: 79874
+Product: Mono: Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: Sys.XML
+AssignedTo: atsushi at ximian.com                            
+ReportedBy: jankit at novell.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XPath query, unable to select element node
+
+Description of Problem:
+
+The XPath query "/Abc/Foo" over xml "<Abc><Foo>Hello</Foo></Abc>" does not
+work on mono. This fails in cases where the node being selected does not
+have any child nodes.
+
+Test case:
+
+using System;
+using System.IO;
+using System.Xml.XPath;
+using System.Xml;
+
+namespace xpath
+{
+    class Program
+    {
+        static void Main (string [] args)
+        {
+                StringReader sr = new StringReader
+(@"<Abc><Foo>Hello</Foo></Abc>");
+            XPathDocument doc = new XPathDocument (sr);
+            XPathNavigator nav = doc.CreateNavigator ();
+
+            XPathNodeIterator iter = nav.Select ("/Abc/Foo");
+            Console.WriteLine (iter.Count);
+            iter.MoveNext ();
+            Console.WriteLine (iter.Current.InnerXml);
+
+       }
+    }
+}
+
+Actual Results:
+radical at ubuntu:~/test/md$ mono one.exe
+1
+
+Unhandled Exception: System.InvalidOperationException: This XmlWriter does
+not accept Text at this state Start.
+  at System.Xml.XmlTextWriter.ShiftStateContent (System.String occured,
+Boolean allowAttribute) [0x00000]
+  at System.Xml.XmlTextWriter.WriteString (System.String text) [0x00000]
+  at System.Xml.XmlWriter.WriteNode (System.Xml.XmlReader reader, Boolean
+defattr) [0x00000]
+  at System.Xml.XPath.XPathNavigator.get_InnerXml () [0x00000]
+  at xpath.Program.Main (System.String[] args) [0x00000]
+
+
+Expected Results:
+
+1
+Hello


More information about the mono-bugs mailing list