This documentation is archived and is not being maintained.

SchemaReference::Url Property

Gets or sets the URL for the schema reference.

Namespace:  System.Web.Services.Discovery
Assembly:  System.Web.Services (in System.Web.Services.dll)

public:
virtual property String^ Url {
	String^ get () override;
	void set (String^ value) override;
}

Property Value

Type: System::String
The URL for the referenced XSD schema. The default value is Empty.

For the SchemaReference class, the Url property returns the value of the Ref property.

// 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;
// Reference the schema document.
String* myStringUrl = S"c:\\Inetpub\\wwwroot\\dataservice.xsd";
XmlSchema* myXmlSchema;

// Create the client protocol.
DiscoveryClientProtocol* myDiscoveryClientProtocol =
   new DiscoveryClientProtocol();
myDiscoveryClientProtocol->Credentials =
   CredentialCache::DefaultCredentials;

//  Create a schema reference.
SchemaReference* mySchemaReferenceNoParam = new SchemaReference();

SchemaReference* mySchemaReference = new SchemaReference(myStringUrl);

// Set the client protocol.
mySchemaReference->ClientProtocol = myDiscoveryClientProtocol;

// Access the default file name associated with the schema reference.
Console::WriteLine(S"Default filename is : {0}",
   mySchemaReference->DefaultFilename);

// Access the namespace associated with schema reference class.
Console::WriteLine(S"Namespace is : {0}", SchemaReference::Namespace);

FileStream* myStream =
   new FileStream(myStringUrl, FileMode::OpenOrCreate);

// Read the document in a stream.
mySchemaReference->ReadDocument(myStream);

// Get the schema of referenced document.
myXmlSchema = mySchemaReference->Schema;

Console::WriteLine(S"Reference is : {0}", mySchemaReference->Ref);

Console::WriteLine(S"Target namespace (default empty) is : {0}",
   mySchemaReference->TargetNamespace);

Console::WriteLine(S"URL is : {0}", mySchemaReference->Url);

// Write the document in the stream.
mySchemaReference->WriteDocument(myXmlSchema, myStream);

myStream->Close();
mySchemaReference = 0;

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Show: