Selaa lähdekoodia

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

	* XmlTextReader.cs : Improved SignificantWhitespace handling.

svn path=/trunk/mcs/; revision=18582
Atsushi Eno 22 vuotta sitten
vanhempi
sitoutus
469f0f2e8a

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

@@ -1,3 +1,7 @@
+2003-10-04  Atsushi Enomoto <[email protected]>
+
+	* XmlTextReader.cs : Improved SignificantWhitespace handling.
+
 2003-10-01  Atsushi Enomoto <[email protected]>
 
 	* XmlSecureResolver.cs : Implemented basic feature.

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

@@ -1262,8 +1262,8 @@ namespace System.Xml
 			if (returnEntityReference && valueBuffer.Length == 0) {
 				SetEntityReferenceProperties ();
 			} else {
-				XmlNodeType nodeType = notWhitespace ?
-					XmlNodeType.Text : XmlNodeType.Whitespace;
+				XmlNodeType nodeType = notWhitespace ? XmlNodeType.Text :
+					this.XmlSpace == XmlSpace.Preserve ? XmlNodeType.SignificantWhitespace : XmlNodeType.Whitespace;
 				SetProperties (
 					nodeType, // nodeType
 					String.Empty, // name
@@ -3057,12 +3057,15 @@ namespace System.Xml
 
 			if (currentState == XmlNodeType.Element && ch != -1 && ch != '<')
 				ReadText (false);
-			else
-				SetProperties (XmlNodeType.Whitespace,
+			else {
+				XmlNodeType nodeType = (this.XmlSpace == XmlSpace.Preserve) ?
+					XmlNodeType.SignificantWhitespace : XmlNodeType.Whitespace;
+				SetProperties (nodeType,
 					       String.Empty,
 					       false,
 					       true,
 					       valueBuffer);
+			}
 
 			return; // (PeekChar () != -1);
 		}