C# Class SIL.FieldWorks.XWorks.FileStreamXmlResolver

Passing null as XmlResolver does not work on Linux. To avoid trying to resolve URLs in a way that works on both platforms we use this dummy class. It does the minimum URL handling to make the Mono validator work. That means it has to handle file:// URLs, because even the base XML file is passed to this routine to resolve. However, it seems to work to return null when resolving a non-file URL (like a DTD on the web), or if we are asked to return some other type besides a stream. The current version returns an empty stream if it is asked for a stream and passed a URI it can't handle. I think this was required in at least one case.
Inheritance: System.Xml.XmlResolver
Exibir arquivo Open project: sillsdev/FieldWorks

Public Methods

Method Description
GetNullResolver ( ) : XmlResolver

Returns a value that can be set as XmlDocument.XmlResolver when we don't want to validate any URLs. This also means not validating against any DTD. On Windows null works (and an instance of this class, in general, doesn't); on Linux an instance of this works, for now. As Mono gets more compatible we may be able (even forced) to retire this.

ResolveUri ( Uri baseUri, string relativeUri ) : Uri

Private Methods

Method Description
FileStreamXmlResolver ( ) : System

Get an instance using GetNullResolver.

GetEntity ( Uri absoluteUri, string role, Type ofObjectToReturn ) : object

Method Details

GetNullResolver() public static method

Returns a value that can be set as XmlDocument.XmlResolver when we don't want to validate any URLs. This also means not validating against any DTD. On Windows null works (and an instance of this class, in general, doesn't); on Linux an instance of this works, for now. As Mono gets more compatible we may be able (even forced) to retire this.
public static GetNullResolver ( ) : XmlResolver
return System.Xml.XmlResolver

ResolveUri() public method

public ResolveUri ( Uri baseUri, string relativeUri ) : Uri
baseUri System.Uri
relativeUri string
return System.Uri