SoapServices.GetInteropFieldTypeAndNameFromXmlElement(Type, String, String, Type, String) メソッド

定義

提供された XML 要素名、名前空間、および格納オブジェクトの型からフィールドの Type と名前を取得します。Retrieves the Type and name of a field from the provided XML element name, namespace, and the containing type.

public:
 static void GetInteropFieldTypeAndNameFromXmlElement(Type ^ containingType, System::String ^ xmlElement, System::String ^ xmlNamespace, [Runtime::InteropServices::Out] Type ^ % type, [Runtime::InteropServices::Out] System::String ^ % name);
public static void GetInteropFieldTypeAndNameFromXmlElement (Type containingType, string xmlElement, string xmlNamespace, out Type type, out string name);
static member GetInteropFieldTypeAndNameFromXmlElement : Type * string * string * Type * string -> unit
Public Shared Sub GetInteropFieldTypeAndNameFromXmlElement (containingType As Type, xmlElement As String, xmlNamespace As String, ByRef type As Type, ByRef name As String)

パラメーター

containingType
Type

フィールドを格納しているオブジェクトの TypeThe Type of the object that contains the field.

xmlElement
String

フィールドの XML 要素名。The XML element name of field.

xmlNamespace
String

フィールドの種類の XML 名前空間。The XML namespace of the field type.

type
Type

このメソッドが返されるときに、フィールドの Type を格納します。When this method returns, contains a Type of the field. このパラメーターは初期化せずに渡されます。This parameter is passed uninitialized.

name
String

このメソッドが返されるときに、フィールドの名前を保持している String を格納します。When this method returns, contains a String that holds the name of the field. このパラメーターは初期化せずに渡されます。This parameter is passed uninitialized.

例外

直前の呼び出し元に、インフラストラクチャ アクセス許可がありません。The immediate caller does not have infrastructure permission.

このメソッドを使用する方法を次のコード例に示します。The following code example shows how to use this method. このコード例は、SoapServices クラスのために提供されている大規模な例の一部です。This code example is part of a larger example provided for the SoapServices class.

// 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(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);

注釈

このメソッドは、含んでいるオブジェクトの型、および .NET Framework によって読み込まれる XML 要素と XML 名前空間を指定して、実際の共通言語ランタイムのフィールド名とフィールドの型を返します。Given the type of the containing object and the XML element and XML namespace that is read in by the .NET Framework, this method returns the actual common language runtime field name and type of the field. .NET Framework は、この情報を使用して、XML ストリームから読み込まれたデータをそのフィールドに入力します。The .NET Framework then uses this information to populate that field with the data read in from the XML stream.

適用対象