[Mono-bugs] [Bug 79875][Nor] New - XPath query, unable to select attributes

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Nov 9 09:16:28 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=79875

--- shadow/79875	2006-11-09 09:16:28.000000000 -0500
+++ shadow/79875.tmp.29087	2006-11-09 09:16:28.000000000 -0500
@@ -0,0 +1,66 @@
+Bug#: 79875
+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 attributes
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+Query: "/Abc/Foo/@attr"
+Xml: "<Abc><Foo attr='val1'/></Abc>"
+
+mono : 
+
+1
+
+Unhandled Exception: System.InvalidOperationException: NodeType Attribute
+is not supported to read as a subtree of an XPathNavigator.
+  at Mono.Xml.XPath.XPathNavigatorReader..ctor
+(System.Xml.XPath.XPathNavigator nav) [0x00000]
+  at System.Xml.XPath.XPathNavigator.ReadSubtree () [0x00000]
+  at System.Xml.XPath.XPathNavigator.get_InnerXml () [0x00000]
+  at xpath.Program.Main (System.String[] args) [0x00000]
+
+.net (expected)
+
+1
+val1
+
+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
+attr='val1'/></Abc>");
+            XPathDocument doc = new XPathDocument (sr);
+            XPathNavigator nav = doc.CreateNavigator ();
+
+            XPathNodeIterator iter = nav.Select ("/Abc/Foo/@attr");
+            Console.WriteLine (iter.Count);
+            iter.MoveNext ();
+            Console.WriteLine (iter.Current.InnerXml);
+        }
+    }
+}


More information about the mono-bugs mailing list