다음을 통해 공유


DiscoveryDocument.Read 메서드

정의

전달된 개체에서 DiscoveryDocument를 읽고 반환합니다.

오버로드

Read(Stream)

전달된 DiscoveryDocument에서 Stream를 읽고 반환합니다.

Read(TextReader)

전달된 DiscoveryDocument에서 TextReader를 읽고 반환합니다.

Read(XmlReader)

전달된 DiscoveryDocument에서 XmlReader를 읽고 반환합니다.

Read(Stream)

전달된 DiscoveryDocument에서 Stream를 읽고 반환합니다.

public:
 static System::Web::Services::Discovery::DiscoveryDocument ^ Read(System::IO::Stream ^ stream);
public static System.Web.Services.Discovery.DiscoveryDocument Read (System.IO.Stream stream);
static member Read : System.IO.Stream -> System.Web.Services.Discovery.DiscoveryDocument
Public Shared Function Read (stream As Stream) As DiscoveryDocument

매개 변수

stream
Stream

Stream를 읽어올 DiscoveryDocument입니다.

반환

검색 문서의 콘텐츠를 포함하며, 전달된 DiscoveryDocument에서 읽어온 Stream입니다.

추가 정보

적용 대상

Read(TextReader)

전달된 DiscoveryDocument에서 TextReader를 읽고 반환합니다.

public:
 static System::Web::Services::Discovery::DiscoveryDocument ^ Read(System::IO::TextReader ^ reader);
public static System.Web.Services.Discovery.DiscoveryDocument Read (System.IO.TextReader reader);
static member Read : System.IO.TextReader -> System.Web.Services.Discovery.DiscoveryDocument
Public Shared Function Read (reader As TextReader) As DiscoveryDocument

매개 변수

reader
TextReader

TextReader를 읽어올 DiscoveryDocument입니다.

반환

검색 문서의 콘텐츠를 포함하며, 전달된 DiscoveryDocument에서 읽어온 TextReader입니다.

예제

다음 코드 예제는 검색 문서를 읽고 " http://localhost/example_Write2_cs.vsdisco "에 XmlTextReader합니다.

// Create a DiscoveryDocument.
DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument;

// Create an XmlTextReader with the sample file.
XmlTextReader^ myXmlTextReader = gcnew XmlTextReader(
   "http://localhost/example_Write2_cs.disco" );

// Read the given XmlTextReader.
myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader );

FileStream^ myFileStream = gcnew FileStream(
   "log.txt",FileMode::OpenOrCreate,FileAccess::Write );
StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream );

XmlTextWriter^ myXmlTextWriter = gcnew XmlTextWriter( myStreamWriter );
myDiscoveryDocument->Write( myXmlTextWriter );

myXmlTextWriter->Flush();
myXmlTextWriter->Close();

// Display the contents of the DiscoveryDocument on the console.
FileStream^ myFileStream1 = gcnew FileStream(
   "log.txt",FileMode::OpenOrCreate,FileAccess::Read );
StreamReader^ myStreamReader = gcnew StreamReader( myFileStream1 );

// Set the file pointer to the beginning.
myStreamReader->BaseStream->Seek( 0, SeekOrigin::Begin );
Console::WriteLine( "The contents of the DiscoveryDocument are: " );
while ( myStreamReader->Peek() > -1 )
{
   Console::WriteLine( myStreamReader->ReadLine() );
}
myStreamReader->Close();
// Create a DiscoveryDocument.
DiscoveryDocument myDiscoveryDocument = new DiscoveryDocument();

// Create an XmlTextReader with the sample file.
XmlTextReader myXmlTextReader = new
   XmlTextReader( "http://localhost/example_Write2_cs.disco" );

// Read the given XmlTextReader.
myDiscoveryDocument = DiscoveryDocument.Read( myXmlTextReader );

FileStream myFileStream = new
   FileStream( "log.txt", FileMode.OpenOrCreate, FileAccess.Write );
StreamWriter myStreamWriter = new StreamWriter( myFileStream );

XmlTextWriter myXmlTextWriter = new XmlTextWriter( myStreamWriter );
myDiscoveryDocument.Write( myXmlTextWriter );

myXmlTextWriter.Flush();
myXmlTextWriter.Close();

// Display the contents of the DiscoveryDocument on the console.
FileStream myFileStream1 = new
   FileStream( "log.txt", FileMode.OpenOrCreate, FileAccess.Read );
StreamReader myStreamReader = new StreamReader( myFileStream1 );

// Set the file pointer to the beginning.
myStreamReader.BaseStream.Seek(0, SeekOrigin.Begin);
Console.WriteLine( "The contents of the DiscoveryDocument are:" );
while ( myStreamReader.Peek() > -1 )
{
   Console.WriteLine( myStreamReader.ReadLine() );
}
myStreamReader.Close();
' Create a DiscoveryDocument.
Dim myDiscoveryDocument As New DiscoveryDocument()

' Create an XmlTextReader with the sample file.
Dim myXmlTextReader As _
    New XmlTextReader("http://localhost/example_Write2_vb.disco")

' Read the given XmlTextReader.
myDiscoveryDocument = DiscoveryDocument.Read(myXmlTextReader)

Dim myFileStream As _
    New FileStream("log.txt", FileMode.OpenOrCreate, FileAccess.Write)
Dim myStreamWriter As New StreamWriter(myFileStream)

Dim myXmlTextWriter As New XmlTextWriter(myStreamWriter)
myDiscoveryDocument.Write(myXmlTextWriter)

myXmlTextWriter.Flush()
myXmlTextWriter.Close()

' Display the contents of the DiscoveryDocument on the console.
Dim myFileStream1 As New FileStream( _
    "log.txt", FileMode.OpenOrCreate, FileAccess.Read)
Dim myStreamReader As New StreamReader(myFileStream1)

' Set the file pointer to the beginning.
myStreamReader.BaseStream.Seek(0, SeekOrigin.Begin)
Console.WriteLine("The contents of the DiscoveryDocument are: ")
While myStreamReader.Peek() > - 1
   Console.WriteLine(myStreamReader.ReadLine())
End While
myStreamReader.Close()

추가 정보

적용 대상

Read(XmlReader)

전달된 DiscoveryDocument에서 XmlReader를 읽고 반환합니다.

public:
 static System::Web::Services::Discovery::DiscoveryDocument ^ Read(System::Xml::XmlReader ^ xmlReader);
public static System.Web.Services.Discovery.DiscoveryDocument Read (System.Xml.XmlReader xmlReader);
static member Read : System.Xml.XmlReader -> System.Web.Services.Discovery.DiscoveryDocument
Public Shared Function Read (xmlReader As XmlReader) As DiscoveryDocument

매개 변수

xmlReader
XmlReader

XmlReader를 읽어올 DiscoveryDocument입니다.

반환

검색 문서의 콘텐츠를 포함하며, 전달된 DiscoveryDocument에서 읽어온 XmlReader입니다.

예제

다음 코드 예제는 경우 검색 문서의 콘텐츠를 읽습니다 합니다 CanRead 속성은 true합니다.

// Check whether the given XmlTextReader is readable.
if ( DiscoveryDocument::CanRead( myXmlTextReader ) == true )
      
// Read the given XmlTextReader.
myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader );
else
      Console::WriteLine( "The supplied file is not readable" );
// Check whether the given XmlTextReader is readable.
if( DiscoveryDocument.CanRead( myXmlTextReader ) == true )
{
   // Read the given XmlTextReader.
   myDiscoveryDocument = DiscoveryDocument.Read( myXmlTextReader );
}
else
{
   Console.WriteLine( "The supplied file is not readable" );
}
' Check whether the given XmlTextReader is readable.
If DiscoveryDocument.CanRead(myXmlTextReader) = True Then
   ' Read the given XmlTextReader.
   myDiscoveryDocument = DiscoveryDocument.Read(myXmlTextReader)
Else
   Console.WriteLine("The supplied file is not readable")
End If

추가 정보

적용 대상