SoapServices.GetInteropFieldTypeAndNameFromXmlElement-Methode
Ruft Type und Name eines Felds aus dem bereitgestellten XML-Elementnamen, dem Namespace und dem Containertyp ab.
Namespace: System.Runtime.Remoting
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Shared Sub GetInteropFieldTypeAndNameFromXmlElement ( _
containingType As Type, _
xmlElement As String, _
xmlNamespace As String, _
<OutAttribute> ByRef type As Type, _
<OutAttribute> ByRef name As String _
)
'Usage
Dim containingType As Type
Dim xmlElement As String
Dim xmlNamespace As String
Dim type As Type
Dim name As String
SoapServices.GetInteropFieldTypeAndNameFromXmlElement(containingType, xmlElement, xmlNamespace, type, name)
public static void GetInteropFieldTypeAndNameFromXmlElement (
Type containingType,
string xmlElement,
string xmlNamespace,
out Type type,
out string name
)
public:
static void GetInteropFieldTypeAndNameFromXmlElement (
Type^ containingType,
String^ xmlElement,
String^ xmlNamespace,
[OutAttribute] Type^% type,
[OutAttribute] String^% name
)
public static void GetInteropFieldTypeAndNameFromXmlElement (
Type containingType,
String xmlElement,
String xmlNamespace,
/** @attribute OutAttribute() */ /** @ref */ Type type,
/** @attribute OutAttribute() */ /** @ref */ String name
)
JScript unterstützt die Übergabe von Werttypargumenten als Verweis nicht.
Parameter
- containingType
Der Type des Objekts, das das Feld enthält.
- xmlElement
Der XML-Elementname des Felds.
- xmlNamespace
Der XML-Namespace des Feldtyps.
- type
Enthält nach dem Beenden dieser Methode einen Type des Felds. Dieser Parameter wird nicht initialisiert übergeben.
- name
Enthält nach dem Beenden dieser Methode einen String mit dem Namen des Felds. Dieser Parameter wird nicht initialisiert übergeben.
Ausnahmen
Ausnahmetyp | Bedingung |
---|---|
Der direkte Aufrufer verfügt nicht über die Berechtigung für die Infrastruktur. |
Hinweise
Bei angegebenem Containerobjekttyp sowie angegebenem XML-Element und XML-Namespace, die von .NET Framework eingelesen werden, gibt diese Methode den tatsächlichen Namen und Typ des Common Language Runtime-Felds zurück. .NET Framework verwendet dann diese Informationen, um dieses Feld mit den aus dem XML-Stream eingelesenen Daten zu füllen.
Beispiel
Im folgenden Codebeispiel wird die Verwendung dieser Methode veranschaulicht. Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die SoapServices-Klasse.
// Get the name and the type of the field using its XML
// element name and its XML namespace. For this query to work,
// the containing type must be preloaded, and the XML element
// name and the XML namespace must be explicitly declared on
// the field using a SoapFieldAttribute.
// Preload the containing type.
SoapServices.PreLoad(typeof(ExampleNamespace.ExampleClass));
// Get the name and the type of a field that will be
// serialized as an XML element.
Type containingType = typeof(ExampleNamespace.ExampleClass);
string xmlElementNamespace =
"http://example.org/ExampleFieldNamespace";
string xmlElementName = "ExampleFieldElementName";
Type fieldType;
string fieldName;
SoapServices.GetInteropFieldTypeAndNameFromXmlElement(
containingType, xmlElementName, xmlElementNamespace,
out fieldType, out fieldName);
Console.WriteLine(
"The type of the field is {0}.",
fieldType);
Console.WriteLine(
"The name of the field is {0}.",
fieldName);
// Get the name and the type of a field that will be
// serialized as an XML attribute.
string xmlAttributeNamespace =
"http://example.org/ExampleAttributeNamespace";
string xmlAttributeName = "ExampleFieldAttributeName";
SoapServices.GetInteropFieldTypeAndNameFromXmlAttribute(
containingType, xmlAttributeName, xmlAttributeNamespace,
out fieldType, out fieldName);
Console.WriteLine(
"The type of the field is {0}.",
fieldType);
Console.WriteLine(
"The name of the field is {0}.",
fieldName);
// Get the name and the type of the field using its XML
// element name and its XML namespace. For this query to work,
// the containing type must be preloaded, and the XML element
// name and the XML namespace must be explicitly declared on
// the field using a SoapFieldAttribute.
// Preload the containing type.
SoapServices::PreLoad( ExampleNamespace::ExampleClass::typeid );
// Get the name and the type of a field that will be
// serialized as an XML element.
Type^ containingType = ExampleNamespace::ExampleClass::typeid;
String^ xmlElementNamespace = L"http://example.org/ExampleFieldNamespace";
String^ xmlElementName = L"ExampleFieldElementName";
Type^ fieldType;
String^ fieldName;
SoapServices::GetInteropFieldTypeAndNameFromXmlElement(
containingType,xmlElementName,xmlElementNamespace,fieldType,fieldName );
Console::WriteLine( L"The type of the field is {0}.", fieldType );
Console::WriteLine( L"The name of the field is {0}.", fieldName );
// Get the name and the type of a field that will be
// serialized as an XML attribute.
String^ xmlAttributeNamespace =
L"http://example.org/ExampleAttributeNamespace";
String^ xmlAttributeName = L"ExampleFieldAttributeName";
SoapServices::GetInteropFieldTypeAndNameFromXmlAttribute(
containingType,xmlAttributeName,xmlAttributeNamespace,fieldType,fieldName );
Console::WriteLine( L"The type of the field is {0}.", fieldType );
Console::WriteLine( L"The name of the field is {0}.", fieldName );
// Get the name and the type of the field using its XML
// element name and its XML namespace. For this query to work,
// the containing type must be preloaded, and the XML element
// name and the XML namespace must be explicitly declared on
// the field using a SoapFieldAttribute.
// Preload the containing type.
SoapServices.PreLoad(ExampleNamespace.ExampleClass.class.ToType());
// Get the name and the type of a field that will be
// serialized as an XML element.
Type containingType = ExampleNamespace.ExampleClass.class.ToType();
String xmlElementNamespace = "http://example.org/ExampleFieldNamespace";
String xmlElementName = "ExampleFieldElementName";
Type fieldType = null;
String fieldName = "";
SoapServices.GetInteropFieldTypeAndNameFromXmlElement(containingType,
xmlElementName, xmlElementNamespace, fieldType, fieldName);
Console.WriteLine("The type of the field is {0}.", fieldType);
Console.WriteLine("The name of the field is {0}.", fieldName);
// Get the name and the type of a field that will be
// serialized as an XML attribute.
String xmlAttributeNamespace
= "http://example.org/ExampleAttributeNamespace";
String xmlAttributeName = "ExampleFieldAttributeName";
SoapServices.GetInteropFieldTypeAndNameFromXmlAttribute(containingType,
xmlAttributeName, xmlAttributeNamespace, fieldType, fieldName);
Console.WriteLine("The type of the field is {0}.", fieldType);
Console.WriteLine("The name of the field is {0}.", fieldName);
.NET Framework-Sicherheit
- SecurityPermission für die Verwendung von Infrastrukturcode. Zugeordnete Enumeration: SecurityPermissionFlag.Infrastructure
Plattformen
Windows 98, Windows 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
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
SoapServices-Klasse
SoapServices-Member
System.Runtime.Remoting-Namespace