Explorar o código

2003-04-26 Atsushi Enomoto <[email protected]>

	* XmlTextReader.cs : fixed ReadInnerXml(). it was inconsistent with
	  Depth property fix.

svn path=/trunk/mcs/; revision=14021
Atsushi Eno %!s(int64=23) %!d(string=hai) anos
pai
achega
98dbcfda5e

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

@@ -1,3 +1,8 @@
+2003-04-26  Atsushi Enomoto <[email protected]>
+
+	* XmlTextReader.cs : fixed ReadInnerXml(). it was inconsistent with
+	  Depth property fix.
+
 2003-04-25  Atsushi Enomoto <[email protected]>
 
 	* XmlDocument.cs : fixed Load() to set baseURI correctly.

+ 8 - 3
mcs/class/System.XML/System.Xml/XmlTextReader.cs

@@ -603,12 +603,17 @@ namespace System.Xml
 				if (innerXmlBuilder == null)
 					innerXmlBuilder = new StringBuilder ();
 				innerXmlBuilder.Length = 0;
+				bool loop = true;
 				do {
 					Read ();
-					if (NodeType != XmlNodeType.EndElement || depth + 1 > startDepth)
+					if (NodeType ==XmlNodeType.None)
+						throw new XmlException ("unexpected end of xml.");
+					else if (NodeType == XmlNodeType.EndElement) {
+						if (depth == startDepth)
+							loop = false;
+					} else
 						innerXmlBuilder.Append (currentTag);
-				} while (depth >= startDepth);
-
+				} while (loop);
 				string xml = innerXmlBuilder.ToString ();
 				innerXmlBuilder.Length = 0;
 				return xml;