SchemaReference Class
Represents a reference in a discovery document to an XML Schema Definition (XSD) language schema. This class cannot be inherited.
System.Web.Services.Discovery::DiscoveryReference
System.Web.Services.Discovery::SchemaReference
Assembly: System.Web.Services (in System.Web.Services.dll)
The SchemaReference type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | SchemaReference() | Initializes a new instance of the SchemaReference class using default values. |
![]() | SchemaReference(String) | Initializes a new instance of the SchemaReference class using the supplied URL as the XSD schema reference. |
| Name | Description | |
|---|---|---|
![]() | ClientProtocol | Gets or sets the instance of DiscoveryClientProtocol used in a discovery process. (Inherited from DiscoveryReference.) |
![]() | DefaultFilename | Gets the name of the default file to use when saving the referenced XSD schema. (Overrides DiscoveryReference::DefaultFilename.) |
![]() | Ref | Gets or sets the URL to the referenced XSD schema. |
![]() | Schema | Gets an XmlSchema object representing the XSD schema. |
![]() | TargetNamespace | Gets or sets the targetNamespace XML attribute of the XSD schema. |
![]() | Url | Gets or sets the URL for the schema reference. (Overrides DiscoveryReference::Url.) |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ReadDocument | Reads and returns the XSD schema from the passed Stream. (Overrides DiscoveryReference::ReadDocument(Stream).) |
![]() | Resolve() | Downloads the referenced document at Url to resolve whether the referenced document is valid. (Inherited from DiscoveryReference.) |
![]() | Resolve(String, Stream) | Resolves whether the referenced document is valid. (Inherited from DiscoveryReference.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | WriteDocument | Writes the passed XSD schema into the passed Stream. (Overrides DiscoveryReference::WriteDocument(Object, Stream).) |
XML Web services discovery involves discovering the available XML Web services given, a URL. A The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existance of XML Web services. These references can refer to service descriptions, XSD schemas, or other discovery documents. This class represents a reference to an XSD schema.
Within a discovery document, a reference to an XSD schema is contained within a schemaRef XML element. The schemaRef XML element has an XML namespace and a ref attribute. The value of the XML namespace must match the Namespace constant. The value of the ref attribute is placed in the Ref property.
#using <System.dll> #using <System.Xml.dll> #using <System.Web.Services.dll> using namespace System; using namespace System::IO; using namespace System::Net; using namespace System::Xml; using namespace System::Xml::Schema; using namespace System::Web::Services::Discovery; int main() { try { // 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; } catch ( Exception^ e ) { Console::WriteLine( e ); } }
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.




