Kaynağa Gözat

* The Depth property was not implemented correctly and the Read method did not
take the newline character into account. The whitespace handling is very preliminary
but it is better than before, where every NON-AREA was being treated as NodeType.Text
example: <Foo name="Blah"> NON-AREA <Bar> TEXT </Bar> NON-AREA </Foo> The text reader
now correctly performs the Depth example found here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxmltextreaderclassdepthtopic.asp

svn path=/trunk/mcs/; revision=7635

Adam Treat 23 yıl önce
ebeveyn
işleme
ec02f3a0bc

+ 12 - 4
mcs/class/System.XML/System.Xml/XmlTextReader.cs

@@ -313,9 +313,13 @@ namespace System.Xml
 			readState = ReadState.Closed;
 			readState = ReadState.Closed;
 		}
 		}
 
 
+		[MonoTODO]
 		public override string GetAttribute (int i)
 		public override string GetAttribute (int i)
 		{
 		{
-			return orderedAttributes [i] as string;
+			if (i > attributes.Count)
+				throw new ArgumentOutOfRangeException ("i is smaller than AttributeCount");
+			else
+				throw new NotImplementedException ();
 		}
 		}
 
 
 		public override string GetAttribute (string name)
 		public override string GetAttribute (string name)
@@ -750,9 +754,6 @@ namespace System.Xml
 				popScope = false;
 				popScope = false;
 			}
 			}
 
 
-			if (depthDown)
-				--depth;
-
 			if (returnEntityReference) {
 			if (returnEntityReference) {
 				++depth;
 				++depth;
 				SetEntityReferenceProperties ();
 				SetEntityReferenceProperties ();
@@ -765,6 +766,12 @@ namespace System.Xml
 					ReadTag ();
 					ReadTag ();
 					more = true;
 					more = true;
 					break;
 					break;
+				case '\n':
+					ReadChar ();
+					return ReadContent ();
+				case ' ':
+					SkipWhitespace ();
+					return ReadContent ();
 				case -1:
 				case -1:
 					readState = ReadState.EndOfFile;
 					readState = ReadState.EndOfFile;
 					SetProperties (
 					SetProperties (
@@ -847,6 +854,7 @@ namespace System.Xml
 
 
 			Expect ('>');
 			Expect ('>');
 
 
+			if (!depthDown)
 			++depth;
 			++depth;
 
 
 			SetProperties (
 			SetProperties (