SchemaReference.Ref Property
.NET Framework 2.0
Gets or sets the URL to the referenced XSD schema.
Namespace: System.Web.Services.Discovery
Assembly: System.Web.Services (in system.web.services.dll)
Assembly: System.Web.Services (in system.web.services.dll)
/** @property */ public String get_Ref () /** @property */ public void set_Ref (String value)
public function get Ref () : String public function set Ref (value : String)
Not applicable.
Property Value
The URL for the referenced XSD schema. The default value is Empty.In a discovery document, a reference to an XSD schema is contained within a schemaRef XML element. The schemaRef XML element has a ref attribute, which is the URL for the referenced XSD schema. The Ref property represents the value of the ref attribute.
// 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 = "c:\\Inetpub\\wwwroot\\dataservice.xsd";
XmlSchema myXmlSchema;
// Create the client protocol.
DiscoveryClientProtocol myDiscoveryClientProtocol =
new DiscoveryClientProtocol();
myDiscoveryClientProtocol.set_Credentials(CredentialCache.
get_DefaultCredentials());
// Create a schema reference.
SchemaReference mySchemaReferenceNoParam = new SchemaReference();
SchemaReference mySchemaReference = new SchemaReference(myStringUrl);
// Set the client protocol.
mySchemaReference.set_ClientProtocol(myDiscoveryClientProtocol);
// Access the default file name associated with the schema reference.
Console.WriteLine("Default filename is : " + mySchemaReference.
get_DefaultFilename());
// Access the namespace associated with schema reference class.
Console.WriteLine("Namespace is : " + 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.get_Schema();
Console.WriteLine("Reference is : " + mySchemaReference.get_Ref());
Console.WriteLine("Target namespace (default empty) is : "
+ mySchemaReference.get_TargetNamespace());
Console.WriteLine("URL is : " + mySchemaReference.get_Url());
// Write the document in the stream.
mySchemaReference.WriteDocument(myXmlSchema, myStream);
myStream.Close();
mySchemaReference = null;
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: