Author: atsushi
Date: 2006-11-09 19:08:43 -0500 (Thu, 09 Nov 2006)
New Revision: 67653

Modified:
   trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
   trunk/mcs/class/System.XML/Mono.Xml.XPath/XPathNavigatorReader.cs
   trunk/mcs/class/System.XML/System.Xml.XPath/ChangeLog
   trunk/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs
   trunk/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog
   trunk/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs
Log:
2006-11-10  Atsushi Enomoto <[EMAIL PROTECTED]>

        * XPathNavigator.cs : InnerXml should allow Text-only content. Fixed
          bug #79874, when tied to XPathNavigatorReader fix.

        * XPathNavigatorReader.cs : removed node type restriction on 
          initialization.  Fixed bug #79874, when tied to XPathNavigator fix.

        * XPathNavigatorTests.cs : added test for bug #79874.



Modified: trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog 2006-11-09 23:36:46 UTC 
(rev 67652)
+++ trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog 2006-11-10 00:08:43 UTC 
(rev 67653)
@@ -1,3 +1,8 @@
+2006-11-10  Atsushi Enomoto <[EMAIL PROTECTED]>
+
+       * XPathNavigatorReader.cs : removed node type restriction on 
+         initialization.  Fixed bug #79874, when tied to XPathNavigator fix.
+
 2006-10-11  Atsushi Enomoto <[EMAIL PROTECTED]>
 
        * XPathEditableDocument.cs : (XmlDocumentEditableNavigator)

Modified: trunk/mcs/class/System.XML/Mono.Xml.XPath/XPathNavigatorReader.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.XPath/XPathNavigatorReader.cs   
2006-11-09 23:36:46 UTC (rev 67652)
+++ trunk/mcs/class/System.XML/Mono.Xml.XPath/XPathNavigatorReader.cs   
2006-11-10 00:08:43 UTC (rev 67653)
@@ -42,13 +42,6 @@
        {
                public XPathNavigatorReader (XPathNavigator nav)
                {
-                       switch (nav.NodeType) {
-                       case XPathNodeType.Element:
-                       case XPathNodeType.Root:
-                               break;
-                       default:
-                               throw new InvalidOperationException 
(String.Format ("NodeType {0} is not supported to read as a subtree of an 
XPathNavigator.", nav.NodeType));
-                       }
                        current = nav.Clone ();
                }
 

Modified: trunk/mcs/class/System.XML/System.Xml.XPath/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.XPath/ChangeLog       2006-11-09 
23:36:46 UTC (rev 67652)
+++ trunk/mcs/class/System.XML/System.Xml.XPath/ChangeLog       2006-11-10 
00:08:43 UTC (rev 67653)
@@ -1,3 +1,8 @@
+2006-11-10  Atsushi Enomoto <[EMAIL PROTECTED]>
+
+       * XPathNavigator.cs : InnerXml should allow Text-only content. Fixed
+         bug #79874, when tied to XPathNavigatorReader fix.
+
 2006-04-10  Atsushi Enomoto <[EMAIL PROTECTED]>
 
        * XPathNavigator.cs : get_OuterXml() returns indented output, without

Modified: trunk/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs       
2006-11-09 23:36:46 UTC (rev 67652)
+++ trunk/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs       
2006-11-10 00:08:43 UTC (rev 67653)
@@ -886,7 +886,10 @@
                                if (NodeType != XPathNodeType.Root)
                                        r.Read ();
                                StringWriter sw = new StringWriter ();
-                               XmlWriter xtw = XmlWriter.Create (sw);
+                               XmlWriterSettings s = new XmlWriterSettings ();
+                               s.ConformanceLevel = ConformanceLevel.Fragment;
+                               s.OmitXmlDeclaration = true;
+                               XmlWriter xtw = XmlWriter.Create (sw, s);
                                while (!r.EOF && r.Depth > depth)
                                        xtw.WriteNode (r, false);
                                return sw.ToString ();
@@ -910,6 +913,7 @@
                                XmlWriterSettings s = new XmlWriterSettings ();
                                s.Indent = true;
                                s.OmitXmlDeclaration = true;
+                               s.ConformanceLevel = ConformanceLevel.Fragment;
                                StringBuilder sb = new StringBuilder ();
                                using (XmlWriter w = XmlWriter.Create (sb, s)) {
                                        WriteSubtree (w);

Modified: trunk/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog  2006-11-09 
23:36:46 UTC (rev 67652)
+++ trunk/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog  2006-11-10 
00:08:43 UTC (rev 67653)
@@ -1,5 +1,9 @@
 2006-10-27  Atsushi Enomoto <[EMAIL PROTECTED]>
 
+       * XPathNavigatorTests.cs : added test for bug #79874.
+
+2006-10-27  Atsushi Enomoto <[EMAIL PROTECTED]>
+
        * XPathNavigatorTests.cs : added (kind of) test for bug #46751.
 
 2006-10-11  Atsushi Enomoto <[EMAIL PROTECTED]>

Modified: 
trunk/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs     
2006-11-09 23:36:46 UTC (rev 67652)
+++ trunk/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs     
2006-11-10 00:08:43 UTC (rev 67653)
@@ -535,6 +535,22 @@
                        nav.MoveToFirstChild ();
                        long l = nav.ValueAsLong;
                }
+
+               [Test] // bug #79874
+               public void InnerXmlText ()
+               {
+                       StringReader sr = new StringReader 
("<Abc><Foo>Hello</Foo></Abc>");
+                       XPathDocument doc = new XPathDocument (sr);
+                       XPathNavigator nav = doc.CreateNavigator ();
+                       XPathNodeIterator iter = nav.Select ("/Abc/Foo");
+                       iter.MoveNext ();
+                       AssertEquals ("#1", "Hello", iter.Current.InnerXml);
+                       AssertEquals ("#2", "<Foo>Hello</Foo>", 
iter.Current.OuterXml);
+                       iter = nav.Select ("/Abc/Foo/text()");
+                       iter.MoveNext ();
+                       AssertEquals ("#3", String.Empty, 
iter.Current.InnerXml);
+                       AssertEquals ("#4", "Hello", iter.Current.OuterXml);
+               }
 #endif
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to