SoapServices.RegisterInteropXmlElement(String, String, Type) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
- 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
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET