Bewerken

Delen via


SoapServices.RegisterInteropXmlElement(String, String, Type) Method

Definition

Associates the given XML element name and namespace with a run-time type that should be used for deserialization.

public:
 static void RegisterInteropXmlElement(System::String ^ xmlElement, System::String ^ xmlNamespace, Type ^ type);
public static void RegisterInteropXmlElement (string xmlElement, string xmlNamespace, Type type);
[System.Security.SecurityCritical]
public static void RegisterInteropXmlElement (string xmlElement, string xmlNamespace, Type type);
static member RegisterInteropXmlElement : string * string * Type -> unit
[<System.Security.SecurityCritical>]
static member RegisterInteropXmlElement : string * string * Type -> unit
Public Shared Sub RegisterInteropXmlElement (xmlElement As String, xmlNamespace As String, type As Type)

Parameters

xmlElement
String

The XML element name to use in deserialization.

xmlNamespace
String

The XML namespace to use in deserialization.

type
Type

The run-time Type to use in deserialization.

Attributes

Exceptions

The immediate caller does not have infrastructure permission.

Examples

The following code example shows how to use this method. This code example is part of a larger example provided for the SoapServices class.

// Get the currently registered type for the given XML element
// and namespace.
String^ registeredXmlElementName = L"ExampleClassElementName";
String^ registeredXmlNamespace =
   L"http://example.org/ExampleXmlNamespace";
Type^ registeredType =
   SoapServices::GetInteropTypeFromXmlElement(
      registeredXmlElementName, registeredXmlNamespace );
Console::WriteLine( L"The registered interop type is {0}.",
   registeredType );

// Register a new type for the XML element and namespace.
SoapServices::RegisterInteropXmlElement(
   registeredXmlElementName,registeredXmlNamespace,String::typeid );

// Get the currently registered type for the given XML element
// and namespace.
registeredType = SoapServices::GetInteropTypeFromXmlElement(
   registeredXmlElementName,registeredXmlNamespace );
Console::WriteLine( L"The registered interop type is {0}.",
   registeredType );
// Get the currently registered type for the given XML element 
// and namespace.
string registeredXmlElementName = 
    "ExampleClassElementName";
string registeredXmlNamespace = 
    "http://example.org/ExampleXmlNamespace";
Type registeredType = 
    SoapServices.GetInteropTypeFromXmlElement(
    registeredXmlElementName, 
    registeredXmlNamespace);
Console.WriteLine(
    "The registered interop type is {0}.",
    registeredType);

// Register a new type for the XML element and namespace.
SoapServices.RegisterInteropXmlElement(
    registeredXmlElementName,
    registeredXmlNamespace, 
    typeof(String));

// Get the currently registered type for the given XML element 
// and namespace.
registeredType = 
    SoapServices.GetInteropTypeFromXmlElement(
    registeredXmlElementName, 
    registeredXmlNamespace);
Console.WriteLine(
    "The registered interop type is {0}.",
    registeredType);

Applies to

See also