Partilhar via


SchemaReference Construtores

Definição

Inicializa uma nova instância da classe SchemaReference.

Sobrecargas

SchemaReference()

Inicializa uma nova instância da classe SchemaReference usando valores padrão.

SchemaReference(String)

Inicializa uma nova instância da classe SchemaReference usando a URL fornecida como uma referência do esquema XSD.

SchemaReference()

Inicializa uma nova instância da classe SchemaReference usando valores padrão.

public:
 SchemaReference();
public SchemaReference ();
Public Sub New ()

Exemplos

// 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.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("Default filename is : " +
    mySchemaReference.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.Schema;

Console.WriteLine("Reference is : " + mySchemaReference.Ref);

Console.WriteLine("Target namespace (default empty) is : " +
    mySchemaReference.TargetNamespace);

Console.WriteLine("URL is : " + mySchemaReference.Url);

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

myStream.Close();
mySchemaReference = null;

' Reference the schema document.
Dim myStringUrl As String = "c:\\Inetpub\\wwwroot\\dataservice.xsd"
Dim myXmlSchema As XmlSchema

' Create the client protocol.
Dim myDiscoveryClientProtocol As DiscoveryClientProtocol = _
    New DiscoveryClientProtocol()
myDiscoveryClientProtocol.Credentials = _
    CredentialCache.DefaultCredentials

' Create a schema reference.
Dim mySchemaReferenceNoParam As SchemaReference = New SchemaReference()

Dim mySchemaReference As SchemaReference = _
    New SchemaReference(myStringUrl)

' Set the client protocol.
mySchemaReference.ClientProtocol = myDiscoveryClientProtocol

' Access the default file name associated with the schema reference.
Console.WriteLine("Default filename is : " & _
    mySchemaReference.DefaultFilename)

' Access the namespace associated with schema reference class.
Console.WriteLine("Namespace is : " & SchemaReference.Namespace)

Dim myStream As FileStream = _
    New FileStream(myStringUrl, FileMode.OpenOrCreate)

' Read the document in a stream.
mySchemaReference.ReadDocument(myStream)

' Get the schema of the referenced document.
myXmlSchema = mySchemaReference.Schema

Console.WriteLine("Reference is : " & mySchemaReference.Ref)

Console.WriteLine("Target namespace (default empty) is : " & _
    mySchemaReference.TargetNamespace)

Console.WriteLine("URL is : " & mySchemaReference.Url)

' Write the document in the stream.
mySchemaReference.WriteDocument(myXmlSchema, myStream)

myStream.Close()
mySchemaReference = Nothing

Aplica-se a

SchemaReference(String)

Inicializa uma nova instância da classe SchemaReference usando a URL fornecida como uma referência do esquema XSD.

public:
 SchemaReference(System::String ^ url);
public:
 SchemaReference(System::String ^ href);
public SchemaReference (string url);
public SchemaReference (string href);
new System.Web.Services.Discovery.SchemaReference : string -> System.Web.Services.Discovery.SchemaReference
new System.Web.Services.Discovery.SchemaReference : string -> System.Web.Services.Discovery.SchemaReference
Public Sub New (url As String)
Public Sub New (href As String)

Parâmetros

urlhref
String

A URL para o esquema XSD. Inicializa a propriedade Ref.

Exemplos

// 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.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("Default filename is : " +
    mySchemaReference.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.Schema;

Console.WriteLine("Reference is : " + mySchemaReference.Ref);

Console.WriteLine("Target namespace (default empty) is : " +
    mySchemaReference.TargetNamespace);

Console.WriteLine("URL is : " + mySchemaReference.Url);

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

myStream.Close();
mySchemaReference = null;

' Reference the schema document.
Dim myStringUrl As String = "c:\\Inetpub\\wwwroot\\dataservice.xsd"
Dim myXmlSchema As XmlSchema

' Create the client protocol.
Dim myDiscoveryClientProtocol As DiscoveryClientProtocol = _
    New DiscoveryClientProtocol()
myDiscoveryClientProtocol.Credentials = _
    CredentialCache.DefaultCredentials

' Create a schema reference.
Dim mySchemaReferenceNoParam As SchemaReference = New SchemaReference()

Dim mySchemaReference As SchemaReference = _
    New SchemaReference(myStringUrl)

' Set the client protocol.
mySchemaReference.ClientProtocol = myDiscoveryClientProtocol

' Access the default file name associated with the schema reference.
Console.WriteLine("Default filename is : " & _
    mySchemaReference.DefaultFilename)

' Access the namespace associated with schema reference class.
Console.WriteLine("Namespace is : " & SchemaReference.Namespace)

Dim myStream As FileStream = _
    New FileStream(myStringUrl, FileMode.OpenOrCreate)

' Read the document in a stream.
mySchemaReference.ReadDocument(myStream)

' Get the schema of the referenced document.
myXmlSchema = mySchemaReference.Schema

Console.WriteLine("Reference is : " & mySchemaReference.Ref)

Console.WriteLine("Target namespace (default empty) is : " & _
    mySchemaReference.TargetNamespace)

Console.WriteLine("URL is : " & mySchemaReference.Url)

' Write the document in the stream.
mySchemaReference.WriteDocument(myXmlSchema, myStream)

myStream.Close()
mySchemaReference = Nothing

Aplica-se a