Browse Source

2004-11-24 Atsushi Enomoto <[email protected]>

	* XmlQualifiedName.cs : in 2.0 it is [Serializable].
	* XmlTextReader.cs : removed unused local variable.
	* XmlTextWriter.cs : Improved some exception messages.
	  moved some private fields into #if NET_2_0.
	* XmlValidatingReader.cs : rename specifiedResolver to
	  resolverSpecified and use it in internal get_Resolver().
	  Added [Obsolete] for ReadTypedValue() whose base is obsoleted.



svn path=/trunk/mcs/; revision=36465
Atsushi Eno 21 years ago
parent
commit
3adcf9dff4

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

@@ -1,3 +1,13 @@
+2004-11-24  Atsushi Enomoto <[email protected]>
+
+	* XmlQualifiedName.cs : in 2.0 it is [Serializable].
+	* XmlTextReader.cs : removed unused local variable.
+	* XmlTextWriter.cs : Improved some exception messages.
+	  moved some private fields into #if NET_2_0.
+	* XmlValidatingReader.cs : rename specifiedResolver to
+	  resolverSpecified and use it in internal get_Resolver().
+	  Added [Obsolete] for ReadTypedValue() whose base is obsoleted.
+
 2004-11-22  Atsushi Enomoto <[email protected]>
 
 	* XmlTextReader.cs : Now attribute normalization is handled on Read(),

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

@@ -33,6 +33,9 @@ using System;
 
 namespace System.Xml
 {
+#if NET_2_0
+	[Serializable]
+#endif
 	public class XmlQualifiedName
 	{
 		// Constructors		

+ 0 - 1
mcs/class/System.XML/System.Xml/XmlTextReader.cs

@@ -609,7 +609,6 @@ namespace System.Xml
 
 			byte b = 0;
 			byte work = 0;
-			bool loop = true;
 			for (int i = 0; i < charsLength - 3; i++) {
 				if ((i = SkipIgnorableBase64Chars (chars, charsLength, i)) == charsLength)
 					break;

+ 7 - 6
mcs/class/System.XML/System.Xml/XmlTextWriter.cs

@@ -85,8 +85,8 @@ namespace System.Xml
 		bool closeOutput = true;
 		bool newLineOnAttributes;
 		string newLineChars;
-		bool outputXmlDeclaration;
 #if NET_2_0
+		bool outputXmlDeclaration;
 		ConformanceLevel conformanceLevel;
 #endif
 
@@ -448,7 +448,7 @@ openElements [openElementCount - 1]).IndentingOverriden;
 		public override void WriteCData (string text)
 		{
 			if (text.IndexOf ("]]>") >= 0)
-				throw new ArgumentException ();
+				throw new ArgumentException ("CDATA section cannot contain text \"]]>\".");
 
 			CheckState ();
 			IndentingOverriden = true;
@@ -485,9 +485,10 @@ openElements [openElementCount - 1]).IndentingOverriden;
 
 		public override void WriteComment (string text)
 		{
-			if ((text.EndsWith("-")) || (text.IndexOf("--") > 0)) {
-				throw new ArgumentException ();
-			}
+			if (text.EndsWith("-"))
+				throw new ArgumentException ("An XML comment cannot contain \"--\" inside.");
+			else if (text.IndexOf("--") > 0)
+				throw new ArgumentException ("An XML comment cannot end with \"-\".");
 			if (ws != WriteState.Content && formatting == Formatting.Indented)
 				w.WriteLine ();
 
@@ -678,7 +679,7 @@ openElements [openElementCount - 1]).IndentingOverriden;
 		public override void WriteProcessingInstruction (string name, string text)
 		{
 			if ((name == null) || (name == string.Empty))
-				throw new ArgumentException ();
+				throw new ArgumentException ("Argument processing instruction name must not be null or empty.");
 			if (!XmlChar.IsName (name))
 				throw new ArgumentException ("Invalid processing instruction name.");
 			if ((text.IndexOf("?>") > 0))

+ 7 - 5
mcs/class/System.XML/System.Xml/XmlValidatingReader.cs

@@ -55,7 +55,7 @@ namespace System.Xml
 		XmlTextReader xmlTextReader;
 		XmlReader validatingReader;
 		XmlResolver resolver; // Only used to non-XmlTextReader XmlReader
-		bool specifiedResolver;
+		bool resolverSpecified;
 		ValidationType validationType;
 		// for 2.0: Now it is obsolete. It is allocated only when it is required
 		XmlSchemaSet schemas;
@@ -267,8 +267,10 @@ namespace System.Xml
 				// silly behavior here.
 				if (this.xmlTextReader != null)
 					return this.xmlTextReader.Resolver;
-				else
+				else if (resolverSpecified)
 					return resolver;
+				else
+					return null;
 			}
 		}
 
@@ -323,11 +325,10 @@ namespace System.Xml
 
 		public XmlResolver XmlResolver {
 			set {
-				specifiedResolver = true;
+				resolverSpecified = true;
+				resolver = value;
 				if (xmlTextReader != null)
 					xmlTextReader.XmlResolver = value;
-				else
-					resolver = value;
 
 				XsdValidatingReader xsvr = validatingReader as XsdValidatingReader;
 				if (xsvr != null)
@@ -536,6 +537,7 @@ namespace System.Xml
 #endif
 
 #if NET_2_0
+		[Obsolete]
 		public override object ReadTypedValue ()
 #else
 		public object ReadTypedValue ()