DiscoveryDocument.Write 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 DiscoveryDocument를 전달된 개체에 씁니다.
오버로드
Write(Stream) |
이 DiscoveryDocument를 Stream에 씁니다. |
Write(TextWriter) |
이 DiscoveryDocument를 TextWriter에 씁니다. |
Write(XmlWriter) |
이 DiscoveryDocument를 XmlWriter에 씁니다. |
Write(Stream)
이 DiscoveryDocument를 Stream에 씁니다.
public:
void Write(System::IO::Stream ^ stream);
public void Write (System.IO.Stream stream);
member this.Write : System.IO.Stream -> unit
Public Sub Write (stream As Stream)
매개 변수
- stream
- Stream
이 Stream가 쓰여질 DiscoveryDocument입니다.
예제
다음 코드 예제에서는 라는 파일에 검색 문서를 씁니다 log.txt
를 사용 하 여를 Write 메서드.
// Create an object of the 'DiscoveryDocument'.
DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument;
// Create an XmlTextReader with the sample file.
XmlTextReader^ myXmlTextReader = gcnew XmlTextReader(
"http://localhost/example_Write1_cs.disco" );
// Read the given XmlTextReader.
myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader );
// Write the DiscoveryDocument into the stream.
FileStream^ myFileStream = gcnew FileStream(
"log.txt",FileMode::OpenOrCreate,FileAccess::Write );
myDiscoveryDocument->Write( myFileStream );
myFileStream->Flush();
myFileStream->Close();
// Display the contents of the DiscoveryDocument onto the console.
FileStream^ myFileStream1 = gcnew FileStream(
"log.txt",FileMode::OpenOrCreate,FileAccess::Read );
StreamReader^ myStreamReader = gcnew StreamReader( myFileStream1 );
// Set the file pointer to the begin.
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 an object of the 'DiscoveryDocument'.
DiscoveryDocument myDiscoveryDocument = new DiscoveryDocument();
// Create an XmlTextReader with the sample file.
XmlTextReader myXmlTextReader = new
XmlTextReader( "http://localhost/example_Write1_cs.disco" );
// Read the given XmlTextReader.
myDiscoveryDocument = DiscoveryDocument.Read( myXmlTextReader );
// Write the DiscoveryDocument into the stream.
FileStream myFileStream = new
FileStream( "log.txt", FileMode.OpenOrCreate, FileAccess.Write );
myDiscoveryDocument.Write( myFileStream );
myFileStream.Flush();
myFileStream.Close();
// Display the contents of the DiscoveryDocument onto the console.
FileStream myFileStream1 = new
FileStream( "log.txt", FileMode.OpenOrCreate, FileAccess.Read );
StreamReader myStreamReader = new StreamReader( myFileStream1 );
// Set the file pointer to the begin.
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 an object of the 'DiscoveryDocument'.
Dim myDiscoveryDocument As New DiscoveryDocument()
' Create an XmlTextReader with the sample file.
Dim myXmlTextReader As New XmlTextReader("http://localhost/example_Write1_vb.disco")
' Read the given XmlTextReader.
myDiscoveryDocument = DiscoveryDocument.Read(myXmlTextReader)
' Write the DiscoveryDocument into the stream.
Dim myFileStream As New FileStream("log.txt", FileMode.OpenOrCreate, FileAccess.Write)
myDiscoveryDocument.Write(myFileStream)
myFileStream.Flush()
myFileStream.Close()
' Display the contents of the DiscoveryDocument onto 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 begin.
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()
추가 정보
적용 대상
Write(TextWriter)
이 DiscoveryDocument를 TextWriter에 씁니다.
public:
void Write(System::IO::TextWriter ^ writer);
public:
void Write(System::IO::TextWriter ^ textWriter);
public void Write (System.IO.TextWriter writer);
public void Write (System.IO.TextWriter textWriter);
member this.Write : System.IO.TextWriter -> unit
member this.Write : System.IO.TextWriter -> unit
Public Sub Write (writer As TextWriter)
Public Sub Write (textWriter As TextWriter)
매개 변수
- writertextWriter
- TextWriter
이 TextWriter가 쓰여질 DiscoveryDocument입니다.
예제
다음 코드 예제에 검색 문서를 작성 한 XmlTextWriter합니다.
// 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()
추가 정보
적용 대상
Write(XmlWriter)
이 DiscoveryDocument를 XmlWriter에 씁니다.
public:
void Write(System::Xml::XmlWriter ^ writer);
public:
void Write(System::Xml::XmlWriter ^ xmlWriter);
public void Write (System.Xml.XmlWriter writer);
public void Write (System.Xml.XmlWriter xmlWriter);
member this.Write : System.Xml.XmlWriter -> unit
member this.Write : System.Xml.XmlWriter -> unit
Public Sub Write (writer As XmlWriter)
Public Sub Write (xmlWriter As XmlWriter)
매개 변수
- writerxmlWriter
- XmlWriter
이 XmlWriter가 쓰여질 DiscoveryDocument입니다.
예제
다음 코드 예제에 검색 문서를 작성 한 XmlTextWriter합니다.
// 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()