New tests.
[mono.git] / mcs / class / System.XML / System.Xml / XmlResolver.cs
index 2635bdd1e30798af463704ab93f0165f861a08b6..0cf9f3172593eaead0697d0b073cef54db557841 100644 (file)
@@ -6,7 +6,7 @@
 //   Atsushi Enomoto (atsushi@ximian.com)
 //
 // (C) 2001 Jason Diamond  http://injektilo.org/
-// (C) 2004 Novell Inc.
+// Copyright (C) 2004,2009 Novell, Inc (http://www.novell.com)
 //
 
 //
@@ -38,7 +38,9 @@ namespace System.Xml
 {
        public abstract class XmlResolver
        {
+#if !MOONLIGHT
                public abstract ICredentials Credentials { set; }
+#endif
 
                public abstract object GetEntity (
                        Uri absoluteUri,
@@ -51,17 +53,18 @@ namespace System.Xml
                        if (baseUri == null) {
                                if (relativeUri == null)
                                        throw new ArgumentNullException ("Either baseUri or relativeUri are required.");
+#if MOONLIGHT
+                               return new Uri (relativeUri, UriKind.RelativeOrAbsolute);
+#else
                                // Don't ignore such case that relativeUri is in fact absolute uri (e.g. ResolveUri (null, "http://foo.com")).
                                if (relativeUri.StartsWith ("http:") ||
                                        relativeUri.StartsWith ("https:") ||
+                                       relativeUri.StartsWith ("ftp:") ||
                                        relativeUri.StartsWith ("file:"))
                                        return new Uri (relativeUri);
                                else
-                                       // extraneous "/a" is required because current Uri stuff 
-                                       // seems ignorant of difference between "." and "./". 
-                                       // I'd be appleciate if it is fixed with better solution.
                                        return new Uri (Path.GetFullPath (relativeUri));
-//                                     return new Uri (new Uri (Path.GetFullPath ("./a")), EscapeRelativeUriBody (relativeUri));
+#endif
                        }
 
                        if (relativeUri == null)
@@ -79,5 +82,13 @@ namespace System.Xml
                                .Replace ("%", "%25")
                                .Replace ("\"", "%22");
                }
+#if MOONLIGHT
+               public virtual bool SupportsType (Uri absoluteUri, Type type)
+               {
+                       if (absoluteUri == null)
+                               throw new ArgumentNullException ("absoluteUri");
+                       return ((type == null) || (type == typeof (Stream)));
+               }
+#endif
        }
 }