Sfoglia il codice sorgente

2005-03-15 Atsushi Enomoto <[email protected]>

	* DTDValidatingReader.cs : When expanding entities and there is a
	  sequence of text nodes, its value was not returned.
	* XmlTextReader.cs : better invalid char error report for EOF.


svn path=/trunk/mcs/; revision=41840
Atsushi Eno 21 anni fa
parent
commit
c6dc16ee40

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

@@ -1,3 +1,9 @@
+2005-03-15  Atsushi Enomoto <[email protected]>
+
+	* DTDValidatingReader.cs : When expanding entities and there is a
+	  sequence of text nodes, its value was not returned.
+	* XmlTextReader.cs : better invalid char error report for EOF.
+
 2005-03-09  Andrew Skiba <[email protected]>
 
 	* XmlTextReader.cs, XmlParserInput.cs, DTDReader.cs: fix UCM-4

+ 7 - 15
mcs/class/System.XML/System.Xml/DTDValidatingReader.cs

@@ -112,7 +112,7 @@ namespace Mono.Xml
 		bool isSignificantWhitespace;
 		bool isWhitespace;
 		bool isText;
-		bool nextMaybeSignificantWhitespace;
+		bool dontResetTextType;
 
 		// This field is used to get properties and to raise events.
 		XmlValidatingReader validatingReader;
@@ -370,7 +370,7 @@ namespace Mono.Xml
 			isWhitespace = false;
 			isSignificantWhitespace = false;
 			isText = false;
-			nextMaybeSignificantWhitespace = false;
+			dontResetTextType = false;
 
 			bool b = ReadContent () || currentTextValue != null;
 			if (!b && this.missingIDReferences.Count > 0) {
@@ -431,7 +431,6 @@ namespace Mono.Xml
 				return false;
 			}
 
-			bool dontResetTextType = false;
 			DTDElementDeclaration elem = null;
 
 			switch (reader.NodeType) {
@@ -569,7 +568,7 @@ namespace Mono.Xml
 					constructingTextValue = null;
 					return true;
 				}
-				goto case XmlNodeType.Text;
+				break;
 			case XmlNodeType.SignificantWhitespace:
 				if (!isText)
 					isSignificantWhitespace = true;
@@ -599,19 +598,9 @@ namespace Mono.Xml
 				}
 				break;
 			case XmlNodeType.Whitespace:
-				if (nextMaybeSignificantWhitespace) {
-					currentTextValue = reader.Value;
-					nextMaybeSignificantWhitespace = false;
-					goto case XmlNodeType.SignificantWhitespace;
-				}
 				if (!isText && !isSignificantWhitespace)
 					isWhitespace = true;
-				if (entityReaderStack.Count > 0 && validatingReader.EntityHandling == EntityHandling.ExpandEntities) {
-					constructingTextValue += reader.Value;
-					return ReadContent ();
-				}
-				ValidateWhitespaceNode ();
-				break;
+				goto case XmlNodeType.Text;
 			case XmlNodeType.EntityReference:
 				if (validatingReader.EntityHandling == EntityHandling.ExpandEntities) {
 					ResolveEntity ();
@@ -619,6 +608,9 @@ namespace Mono.Xml
 				}
 				break;
 			}
+			if (isWhitespace)
+				ValidateWhitespaceNode ();
+			currentTextValue = constructingTextValue;
 			constructingTextValue = null;
 			MoveToElement ();
 			return true;

+ 2 - 2
mcs/class/System.XML/System.Xml/XmlTextReader.cs

@@ -2569,7 +2569,7 @@ namespace System.Xml
 						"expected '{0}' ({1:X}) but found '{2}' ({3:X})",
 						(char) expected,
 						expected,
-						(char) ch,
+						ch < 0 ? (object) "EOF" : (char) ch,
 						ch));
 			}
 		}
@@ -2588,7 +2588,7 @@ namespace System.Xml
 				if (i < 0x21 && XmlChar.IsWhitespace (i))
 					continue;
 				if (c != i)
-					throw NotWFError (String.Format (CultureInfo.InvariantCulture, "Expected {0}, but found {1} [{2}]", c, (char) i, i));
+					throw NotWFError (String.Format (CultureInfo.InvariantCulture, "Expected {0}, but found {1} [{2}]", c, i < 0 ? (object) "EOF" : (char) i, i));
 				break;
 			}
 		}