MatchAttribute 클래스

정의

텍스트 패턴 일치를 사용하여 만든 일치 요소의 특성을 나타냅니다. 이 클래스는 상속될 수 없습니다.

public ref class MatchAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.All)]
public sealed class MatchAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.All)>]
type MatchAttribute = class
    inherit Attribute
Public NotInheritable Class MatchAttribute
Inherits Attribute
상속
MatchAttribute
특성

예제

#using <System.dll>
#using <System.Web.Services.dll>

using namespace System;
using namespace System::Web::Services::Protocols;

public ref class Example_Headers
{
public:

   [MatchAttribute("TITLE>(.*?)<")]
   String^ Title;

   [MatchAttribute("",Pattern="h1>(.*?)<",IgnoreCase=true)]
   String^ H1;

   [MatchAttribute("H2>((([^<,]*),?)+)<",Group=3,Capture=4)]
   String^ Element;

   [MatchAttribute("H2>((([^<,]*),?){2,})<",Group=3,MaxRepeats=0)]
   array<String^>^ Elements1;

   [MatchAttribute("H2>((([^<,]*),?){2,})<",Group=3,MaxRepeats=1)]
   array<String^>^ Elements2;

   [MatchAttribute("H3 ([^=]*)=([^>]*)",Group=1)]
   String^ Attribute;

   [MatchAttribute("H3 ([^=]*)=([^>]*)",Group=2)]
   String^ Value;
};

public ref class MatchAttribute_Example: public HttpGetClientProtocol
{
public:
   MatchAttribute_Example()
   {
      Url = "http://localhost";
   }

   [HttpMethodAttribute(TextReturnReader::typeid,UrlParameterWriter::typeid)]
   Example_Headers^ GetHeaders()
   {
      return ((Example_Headers^)(Invoke( "GetHeaders", ( Url + "/MyHeaders.html" ),
         gcnew array<Object^>(0) )));
   }

   System::IAsyncResult^ BeginGetHeaders( System::AsyncCallback^ callback,
      Object^ asyncState )
   {
      return BeginInvoke( "GetHeaders", ( Url + "/MyHeaders.html" ),
         gcnew array<Object^>(0), callback, asyncState );
   }

   Example_Headers^ EndGetHeaders( System::IAsyncResult^ asyncResult )
   {
      return (Example_Headers^)(EndInvoke( asyncResult ));
   }
};
using System;
using System.Web.Services.Protocols;

public class MatchAttribute_Example : HttpGetClientProtocol
{
    public MatchAttribute_Example()
    {
        Url = "http://localhost";
    }

    [HttpMethodAttribute(typeof(TextReturnReader), typeof(UrlParameterWriter))]
    public Example_Headers GetHeaders()
    {
        return ((Example_Headers)Invoke("GetHeaders", (Url + "/MyHeaders.html"),
            new object[0]));
    }

    public System.IAsyncResult BeginGetHeaders(System.AsyncCallback callback,
        object asyncState)
    {
        return BeginInvoke("GetHeaders", (Url + "/MyHeaders.html"),
            new object[0], callback, asyncState);
    }

    public Example_Headers EndGetHeaders(System.IAsyncResult asyncResult)
    {
        return (Example_Headers)(EndInvoke(asyncResult));
    }
}
public class Example_Headers
{
    [MatchAttribute("TITLE>(.*?)<")]
    public string Title;

    [MatchAttribute("", Pattern="h1>(.*?)<", IgnoreCase=true)]
    public string H1;

    [MatchAttribute("H2>((([^<,]*),?)+)<", Group=3, Capture=4)]
    public string Element;

    [MatchAttribute("H2>((([^<,]*),?){2,})<", Group=3, MaxRepeats=0)]
    public string[] Elements1;

    [MatchAttribute("H2>((([^<,]*),?){2,})<", Group=3, MaxRepeats=1)]
    public string[] Elements2;

    [MatchAttribute("H3 ([^=]*)=([^>]*)", Group=1)]
    public string Attribute;

    [MatchAttribute("H3 ([^=]*)=([^>]*)", Group=2)]
    public string Value;
}
Imports System.Web.Services.Protocols


Public Class MatchAttribute_Example
    Inherits HttpGetClientProtocol

    Public Sub New()
        Url = "http://localhost"
    End Sub

    <HttpMethodAttribute(GetType(TextReturnReader), GetType(UrlParameterWriter))> _
    Public Function GetHeaders() As Headers
        Return CType(Invoke("GetHeaders", Url + "/MyHeaders.html", New Object(0) {}), Headers)
    End Function 'GetHeaders


    Public Function BeginGetHeaders(ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As _
                                                                         System.IAsyncResult
        Return BeginInvoke("GetHeaders", Url + "/MyHeaders.html", New Object(0) {}, _
                                                                          callback, asyncState)
    End Function 'BeginGetHeaders


    Public Function EndGetHeaders(ByVal asyncResult As System.IAsyncResult) As Headers
        Return CType(EndInvoke(asyncResult), Headers)
    End Function 'EndGetHeaders
End Class

Public Class Headers

    <MatchAttribute("TITLE>(.*?)<")> _
    Public Title As String

    <MatchAttribute("", Pattern:="h1>(.*?)<", IgnoreCase:=True)> _
    Public H1 As String

    <MatchAttribute("H2>((([^<,]*),?)+)<", Group:=3, Capture:=4)> _
    Public Element As String

    <MatchAttribute("H2>((([^<,]*),?){2,})<", Group:=3, MaxRepeats:=0)> _
    Public Elements1() As String

    <MatchAttribute("H2>((([^<,]*),?){2,})<", Group:=3, MaxRepeats:=1)> _
    Public Elements2() As String

    <MatchAttribute("H3 ([^=]*)=([^>]*)", Group:=1)> _
    Public Attribute As String

    <MatchAttribute("H3 ([^=]*)=([^>]*)", Group:=2)> _
    Public Value As String
End Class

설명

텍스트 패턴 일치에서는 정규식을 사용 하 여 구문 분석 하 여 기존 HTML을 활용 하 여 XML 웹 서비스를 콘텐츠. XML 웹 서비스를 일치 항목 요소를 사용 하는 서비스 설명에 구문 분석 하려는 콘텐츠를 지정 합니다. 이러한 요소를 일치 항목을 지정: 페이지, 구문 분석 하는 대/소문자를 해야 하는지 여부 및 정규식과 일치 하는 콘텐츠의 인스턴스 개수를 반환할 기존 html 콘텐츠를 구문 분석 하는 것에 대 한 정규식입니다. 프록시 클래스의 메서드를 포함 하는 Wsdl.exe 도구를 사용 하 여 프록시 클래스를 작성 하는 클라이언트를 하는 경우는 MatchAttribute 서비스 설명에서 찾을 수 있는 일치 요소를 자세히 설명 합니다.

텍스트 패턴 일치에 대한 자세한 내용은 방법: 웹 페이지의 콘텐츠를 구문 분석하는 웹 서비스 만들기를 참조하세요.

생성자

MatchAttribute(String)

지정된 패턴을 사용하여 MatchAttribute 클래스의 새 인스턴스를 초기화합니다.

속성

Capture

그룹에 있는 일치 요소의 인덱스를 나타내는 값을 가져오거나 설정합니다.

Group

관련된 일치 요소의 그룹을 나타내는 값을 가져오거나 설정합니다.

IgnoreCase

일치시킬 패턴이 대/소문자를 구분하지 않는지 여부를 나타내는 값을 가져오거나 설정합니다.

MaxRepeats

해당 일치 요소에서 반환할 값의 최대 개수를 가져오거나 설정합니다.

Pattern

일치시킬 패턴을 나타내는 정규식을 가져오거나 설정합니다.

TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)

메서드

Equals(Object)

이 인스턴스가 지정된 개체와 같은지를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

(다음에서 상속됨 Attribute)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다.

(다음에서 상속됨 Attribute)
Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상