다음을 통해 공유


SoapServices.GetInteropFieldTypeAndNameFromXmlElement 메서드

정의

제공된 XML 요소 이름, 네임스페이스 및 포함하는 형식에서 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

필드가 들어 있는 개체의 Type입니다.

xmlElement
String

필드의 XML 요소 이름입니다.

xmlNamespace
String

필드 형식의 XML 네임스페이스입니다.

type
Type

이 메서드가 반환될 때 필드의 Type을 포함합니다. 이 매개 변수는 초기화되지 않은 상태로 전달됩니다.

name
String

이 메서드가 반환될 때 필드 이름이 들어 있는 String을 포함합니다. 이 매개 변수는 초기화되지 않은 상태로 전달됩니다.

예외

직접 실행 호출자에 인프라 권한이 없는 경우

예제

다음 코드 예제에서는 이 메서드를 사용하는 방법을 보여 줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 SoapServices 클래스입니다.

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

설명

이 메서드는 형식과 XML 요소를 포함 하는 개체 및.NET Framework에서 읽을 수 있는 XML 네임 스페이스를 실제 공용 언어 런타임 필드 이름과 필드의 형식을 반환 합니다. .NET Framework는 다음에 XML 스트림에서 읽은 데이터를 사용 하 여 해당 필드를 채우는 데이 정보를 사용 합니다.

적용 대상