XmlUrlResolver.GetEntity メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > XmlUrlResolver.GetEntity メソッドの意味・解説 

XmlUrlResolver.GetEntity メソッド

URI実際リソースを含むオブジェクト割り当てます

名前空間: System.Xml
アセンブリ: System.Xml (system.xml.dll 内)
構文構文

Public Overrides Function
 GetEntity ( _
    absoluteUri As Uri, _
    role As String, _
    ofObjectToReturn As Type _
) As Object
Dim instance As XmlUrlResolver
Dim absoluteUri As Uri
Dim role As String
Dim ofObjectToReturn As Type
Dim returnValue As Object

returnValue = instance.GetEntity(absoluteUri, role, ofObjectToReturn)
public override Object GetEntity (
    Uri absoluteUri,
    string role,
    Type ofObjectToReturn
)
public:
virtual Object^ GetEntity (
    Uri^ absoluteUri, 
    String^ role, 
    Type^ ofObjectToReturn
) override
public Object GetEntity (
    Uri absoluteUri, 
    String role, 
    Type ofObjectToReturn
)
public override function GetEntity (
    absoluteUri : Uri, 
    role : String, 
    ofObjectToReturn : Type
) : Object

パラメータ

absoluteUri

ResolveUri から返されURI

role

現在の実装は、URI解決するときにこのパラメータ使用しません。このパラメータは、将来拡張のために提供されています。たとえば、このパラメータxlink:role割り当て別の場合実装固有の引数として使用できます

ofObjectToReturn

返すオブジェクトの型。現在の実装だけが、System.IO.Stream オブジェクト返します

戻り値
System.IO.Stream オブジェクトストリーム以外の型が指定され場合null 参照 (Visual Basic では Nothing)。

例外例外
例外種類条件

XmlException

ofObjectToReturnnull 参照 (Visual Basic では Nothing) でも Stream 型でもありません。

UriFormatException

指定した URI絶対 URI ではありません。

NullReferenceException

absoluteUrinull 参照 (Visual Basic では Nothing) です。

Exception

ランタイム エラー (サーバー接続中断など) があります

解説解説
使用例使用例

GetEntity メソッドResolveUri メソッドの例を次に示します

Imports System
Imports System.IO
Imports System.Xml

Public Class Sample
    
  Public Shared Sub Main()

     Dim resolver As New
 XmlUrlResolver()
     Dim baseUri As New
 Uri("http://servername/tmp/test.xsl")
     Dim fulluri As Uri = resolver.ResolveUri(baseUri,
 "includefile.xsl")
            
     ' Get a stream object containing the XSL file
     Dim s As Stream = CType(resolver.GetEntity(fulluri,
 Nothing, GetType(Stream)), Stream)
            
     ' Read the stream object displaying the contents of the XSL file
     Dim reader As New XmlTextReader(s)
     While reader.Read()
        Console.WriteLine(reader.ReadOuterXml())
     End While
        
  End Sub 'New 
End Class 'Sample
using System;
using System.IO;
using System.Xml;
 
 public class Sample
 {
          
   public static void Main()
   {
       XmlUrlResolver resolver = new XmlUrlResolver();
 
       Uri baseUri = new Uri ("http://servername/tmp/test.xsl");
 
       Uri fulluri=resolver.ResolveUri(baseUri, "includefile.xsl");
 
       // Get a stream object containing the XSL file
       Stream s=(Stream)resolver.GetEntity(fulluri, null, typeof(Stream));
 
       // Read the stream object displaying the contents of the XSL
 file
       XmlTextReader reader = new XmlTextReader(s);
       while (reader.Read()) 
       {
          Console.WriteLine(reader.ReadOuterXml());
       } 
   }
}
#using <System.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;

int main()
{
   XmlUrlResolver^ resolver = gcnew XmlUrlResolver;
   Uri^ baseUri = gcnew Uri( "http://servername/tmp/test.xsl"
 );
   Uri^ fulluri = resolver->ResolveUri( baseUri, "includefile.xsl" );

   // Get a stream object containing the XSL file
   Stream^ s = dynamic_cast<Stream^>(resolver->GetEntity( fulluri, nullptr,
 Stream::typeid ));

   // Read the stream object displaying the contents of the XSL file
   XmlTextReader^ reader = gcnew XmlTextReader( s );
   while ( reader->Read() )
   {
      Console::WriteLine( reader->ReadOuterXml() );
   }
}
import System.*;
import System.IO.*;
import System.Xml.*;

public class Sample
{    
    public static void main(String[]
 args)
    {
        XmlUrlResolver resolver =  new XmlUrlResolver();
        Uri baseUri =  new Uri("http://servername/tmp/test.xsl");
        Uri fullUri = resolver.ResolveUri(baseUri, "includefile.xsl");

        // Get a stream object containing the XSL file
        Stream s = ((Stream)(resolver.GetEntity(fullUri, null
,
            Stream.class.ToType())));

        // Read the stream object displaying the contents of the XSL
 file
        XmlTextReader reader =  new XmlTextReader(s);
        while(reader.Read()) {
            Console.WriteLine(reader.ReadOuterXml());
        }
    } //main
} //Sample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「XmlUrlResolver.GetEntity メソッド」の関連用語

XmlUrlResolver.GetEntity メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



XmlUrlResolver.GetEntity メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS