Ver código fonte

2003-06-15 Atsushi Enomoto <[email protected]>

	* XmlNodeReader.cs : this [name] and this [name, ns] (and
	  GetAttribute() methods in turn) returns null instead of String.Empty.
	* XmlTextWriter.cs : WriteStartAttribute() should try to use specified
	  prefix before auto-generating prefixes.
	  Implemented WriteBase64().

svn path=/trunk/mcs/; revision=15412
Atsushi Eno 22 anos atrás
pai
commit
0f270e7736

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

@@ -1,3 +1,11 @@
+2003-06-15  Atsushi Enomoto <[email protected]>
+
+	* XmlNodeReader.cs : this [name] and this [name, ns] (and
+	  GetAttribute() methods in turn) returns null instead of String.Empty.
+	* XmlTextWriter.cs : WriteStartAttribute() should try to use specified
+	  prefix before auto-generating prefixes.
+	  Implemented WriteBase64().
+
 2003-06-13  Atsushi Enomoto <[email protected]>
 
 	* XmlNodeReader.cs : LookupNamespace () has refered invalid current

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

@@ -206,7 +206,7 @@ namespace System.Xml
 
 				XmlAttribute attr = ownerElement.Attributes [name];
 				if (attr == null)
-					return String.Empty;
+					return null;
 				else
 					return attr.Value;
 			}
@@ -223,7 +223,7 @@ namespace System.Xml
 
 				XmlAttribute attr = ownerElement.Attributes [name, namespaceURI];
 				if (attr == null)
-					return String.Empty;
+					return null;	// In fact MS.NET returns null instead of String.Empty.
 				else
 					return attr.Value;
 			}

+ 9 - 1
mcs/class/System.XML/System.Xml/XmlTextWriter.cs

@@ -312,6 +312,13 @@ namespace System.Xml
 
 		public override void WriteBase64 (byte[] buffer, int index, int count)
 		{
+			CheckState ();
+
+			if (!openAttribute) {
+				IndentingOverriden = true;
+				CloseStartElement ();
+			}
+
 			w.Write (Convert.ToBase64String (buffer, index, count));
 		}
 
@@ -553,7 +560,8 @@ namespace System.Xml
 				if (existingPrefix == null) 
 				{
 					newAttributeNamespaces.Add (ns);
-					prefix = "d" + indentLevel + "p" + newAttributeNamespaces.Count;
+					if (prefix == "" || namespaceManager.LookupNamespace (prefix) != null)
+						prefix = "d" + indentLevel + "p" + newAttributeNamespaces.Count;
 					namespaceManager.AddNamespace (prefix, ns);
 				}