This documentation is archived and is not being maintained.
DiscoveryDocument::Read Method (TextReader)
Visual Studio 2010
Reads and returns a DiscoveryDocument from the passed TextReader.
Assembly: System.Web.Services (in System.Web.Services.dll)
Parameters
- reader
- Type: System.IO::TextReader
The TextReader from which to read the DiscoveryDocument.
Return Value
Type: System.Web.Services.Discovery::DiscoveryDocumentA DiscoveryDocument containing the contents of a discovery document from the passed TextReader.
The following code example reads the discovery document from " http://localhost/example_Write2_cs.vsdisco " into a 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();
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: