Nowadays, XmlDeclaratoin.WriteTo() writes PI instead of raw.
[mono.git] / mcs / class / System.XML / System.Xml / XmlNameEntry.cs
index 46a830117ffee4c632d727d6bd8fcd0366b63c67..71110d19efd42be6617ce84d658bb49e83f1ebf5 100644 (file)
@@ -45,7 +45,7 @@ namespace System.Xml
                        Prefix = prefix;
                        LocalName = local;
                        NS = ns;
-                       Hash = prefix.GetHashCode () + local.GetHashCode () + ns.GetHashCode ();
+                       Hash = local.GetHashCode () + (prefix.Length > 0 ? prefix.GetHashCode () : 0);
                }
 
                public string Prefix;
@@ -53,6 +53,8 @@ namespace System.Xml
                public string NS;
                public int Hash;
 
+               string prefixed_name_cache;
+
                public override bool Equals (object other)
                {
                        XmlNameEntry e = other as XmlNameEntry;
@@ -66,5 +68,13 @@ namespace System.Xml
                {
                        return Hash;
                }
+
+               public string GetPrefixedName (XmlNameEntryCache owner)
+               {
+                       if (prefixed_name_cache == null)
+                               prefixed_name_cache =
+                                       owner.GetAtomizedPrefixedName (Prefix, LocalName);
+                       return prefixed_name_cache;
+               }
        }
 }