XmlTextWriter work on BaseStream, WriteState, and Namespaces.
[mono.git] / mcs / class / System.XML / System.Xml / XmlNamespaceManager.cs
index 5b3a3b3e8cc5a71241086548cf7bbea97e1e06f6..56dcaf5d88ca1535fd3d83ac29a7d37bde5fec6c 100644 (file)
@@ -101,10 +101,26 @@ namespace System.Xml
                        return null;
                }
 
-               [MonoTODO]
                public virtual string LookupPrefix (string uri)
                {
-                       throw new NotImplementedException ();
+                       if (uri == null)
+                               return null;
+
+                       NamespaceScope scope = currentScope;
+
+                       while (scope != null) 
+                       {
+                               if (scope.Namespaces != null && scope.Namespaces.ContainsValue (uri)) {
+                                       foreach (DictionaryEntry entry in scope.Namespaces) {
+                                               if (entry.Value.ToString() == uri)
+                                                       return nameTable.Get (entry.Key as string) as string;
+                                       }
+                               }
+
+                               scope = scope.Next;
+                       }
+
+                       return String.Empty;
                }
 
                public virtual bool PopScope ()