Forráskód Böngészése

2008-04-02 Atsushi Enomoto <[email protected]>

	* XPathNavigator.cs : fixed InnerXml to not give up with root node.
	  Indent InnerXml. Fixed bug #376191.

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


svn path=/trunk/mcs/; revision=99623
Atsushi Eno 18 éve
szülő
commit
bea2f84c76

+ 5 - 0
mcs/class/System.XML/System.Xml.XPath/ChangeLog

@@ -1,3 +1,8 @@
+2008-04-02  Atsushi Enomoto <[email protected]>
+
+	* XPathNavigator.cs : fixed InnerXml to not give up with root node.
+	  Indent InnerXml. Fixed bug #376191.
+
 2008-02-27  Atsushi Enomoto <[email protected]>
 
 	* XPathNavigator.cs : in some MoveTo*() methods, it should allow any

+ 3 - 0
mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs

@@ -928,8 +928,11 @@ namespace System.Xml.XPath
 				int depth = r.Depth;
 				if (NodeType != XPathNodeType.Root)
 					r.Read ();
+				else
+					depth = -1; // for Root, it should consume the entire tree, so no depth check is done.
 				StringWriter sw = new StringWriter ();
 				XmlWriterSettings s = new XmlWriterSettings ();
+				s.Indent = true;
 				s.ConformanceLevel = ConformanceLevel.Fragment;
 				s.OmitXmlDeclaration = true;
 				XmlWriter xtw = XmlWriter.Create (sw, s);

+ 4 - 0
mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog

@@ -1,3 +1,7 @@
+2008-04-02  Atsushi Enomoto <[email protected]>
+
+	* XPathNavigatorTests.cs : added test for bug #376191.
+
 2008-03-17  Atsushi Enomoto <[email protected]>
 
 	* XPathNavigatorTests.cs : added test for bug #324606.

+ 14 - 0
mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs

@@ -674,6 +674,20 @@ namespace MonoTests.System.Xml
 <child3 />";
 			AssertEquals (result, n.OuterXml.Replace ("\r\n", "\n"));
 		}
+
+		[Test] // bug #376191
+		public void InnerXmlOnRoot ()
+		{
+			XmlDocument document = new XmlDocument ();
+			document.LoadXml (@"<test>
+			<node>z</node>
+			<node>a</node>
+			<node>b</node>
+			<node>q</node>
+			</test>");
+			XPathNavigator navigator = document.CreateNavigator();
+			AssertEquals (navigator.OuterXml, navigator.InnerXml);
+		}
 #endif
 	}
 }