Bläddra i källkod

* XmlNamespaceManager.cs: XmlReader.Read calls LookupNamespace via
the internal sig, which skips any overrides that might exist on
subclasses, so redirect all calls to the public call to make sure
all overrides are called as well.
Make AddNamespace, HasNamespace and RemoveNamespace private.

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

Andreia Gaita 16 år sedan
förälder
incheckning
3353c5052a

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

@@ -1,3 +1,11 @@
+2009-11-13  Andreia Gaita  <[email protected]>
+
+	* XmlNamespaceManager.cs: XmlReader.Read calls LookupNamespace via
+	the internal sig, which skips any overrides that might exist on
+	subclasses, so redirect all calls to the public call to make sure
+	all overrides are called as well.
+	Make AddNamespace, HasNamespace and RemoveNamespace private.
+
 2009-11-11  Atsushi Enomoto  <[email protected]>
 
 	* XmlDocument.cs, XmlElement.cs, XmlAttribute.cs,

+ 14 - 9
mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs

@@ -94,6 +94,7 @@ namespace System.Xml
 		internal const string XmlnsXmlns = "http://www.w3.org/2000/xmlns/";
 		internal const string PrefixXml = "xml";
 		internal const string PrefixXmlns = "xmlns";
+		internal bool internalAtomizedNames;
 
 		#endregion
 
@@ -139,7 +140,7 @@ namespace System.Xml
 			AddNamespace (prefix, uri, false);
 		}
 
-		internal virtual void AddNamespace (string prefix, string uri, bool atomizedNames)
+		void AddNamespace (string prefix, string uri, bool atomizedNames)
 		{
 			if (prefix == null)
 				throw new ArgumentNullException ("prefix", "Value cannot be null.");
@@ -264,7 +265,7 @@ namespace System.Xml
 			return HasNamespace (prefix, false);
 		}
 
-		internal virtual bool HasNamespace (string prefix, bool atomizedNames)
+		bool HasNamespace (string prefix, bool atomizedNames)
 		{
 			if (prefix == null || count == 0)
 				return false;
@@ -278,11 +279,6 @@ namespace System.Xml
 		}
 
 		public virtual string LookupNamespace (string prefix)
-		{
-			return LookupNamespace (prefix, false);
-		}
-
-		internal virtual string LookupNamespace (string prefix, bool atomizedNames)
 		{
 			switch (prefix) {
 			case PrefixXmlns:
@@ -296,13 +292,22 @@ namespace System.Xml
 			}
 
 			for (int i = declPos; i >= 0; i--) {
-				if (CompareString (decls [i].Prefix, prefix, atomizedNames) && decls [i].Uri != null /* null == flag for removed */)
+				if (CompareString (decls [i].Prefix, prefix, internalAtomizedNames) && decls [i].Uri != null /* null == flag for removed */)
 					return decls [i].Uri;
 			}
 			
 			return null;
 		}
 
+		internal string LookupNamespace (string prefix, bool atomizedNames)
+		{
+			internalAtomizedNames = atomizedNames;
+			string ret = LookupNamespace (prefix);
+			internalAtomizedNames = false;
+			return ret;
+
+		}
+
 		public virtual string LookupPrefix (string uri)
 		{
 #if NET_2_0
@@ -398,7 +403,7 @@ namespace System.Xml
 			RemoveNamespace (prefix, uri, false);
 		}
 
-		internal virtual void RemoveNamespace (string prefix, string uri, bool atomizedNames)
+		void RemoveNamespace (string prefix, string uri, bool atomizedNames)
 		{
 			if (prefix == null)
 				throw new ArgumentNullException ("prefix");