This documentation is archived and is not being maintained.
SchemaReference::WriteDocument Method
Visual Studio 2010
Writes the passed XSD schema into the passed Stream.
Assembly: System.Web.Services (in System.Web.Services.dll)
Parameters
- document
- Type: System::Object
The XmlSchema to write into stream.
- stream
- Type: System.IO::Stream
The Stream into which the serialized XSD schema is written.
// Reference the schema document. String^ myStringUrl = "c:\\Inetpub\\wwwroot\\dataservice.xsd"; XmlSchema^ myXmlSchema; // Create the client protocol. DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; // Create a schema reference. SchemaReference^ mySchemaReferenceNoParam = gcnew SchemaReference; SchemaReference^ mySchemaReference = gcnew SchemaReference( myStringUrl ); // Set the client protocol. mySchemaReference->ClientProtocol = myDiscoveryClientProtocol; // Access the default file name associated with the schema reference. Console::WriteLine( "Default filename is : {0}", mySchemaReference->DefaultFilename ); // Access the namespace associated with schema reference class. Console::WriteLine( "Namespace is : {0}", SchemaReference::Namespace ); FileStream^ myStream = gcnew FileStream( myStringUrl,FileMode::OpenOrCreate ); // Read the document in a stream. mySchemaReference->ReadDocument( myStream ); // Get the schema of referenced document. myXmlSchema = mySchemaReference->Schema; Console::WriteLine( "Reference is : {0}", mySchemaReference->Ref ); Console::WriteLine( "Target namespace (default empty) is : {0}", mySchemaReference->TargetNamespace ); Console::WriteLine( "URL is : {0}", mySchemaReference->Url ); // Write the document in the stream. mySchemaReference->WriteDocument( myXmlSchema, myStream ); myStream->Close(); mySchemaReference = nullptr;
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: