次の方法で共有


MatchAttribute クラス

テキストのパターン一致により一致した属性を表します。このクラスは継承できません。

この型のすべてのメンバの一覧については、MatchAttribute メンバ を参照してください。

System.Object
   System.Attribute
      System.Web.Services.Protocols.MatchAttribute

<AttributeUsage(AttributeTargets.All)>
NotInheritable Public Class MatchAttribute   Inherits Attribute
[C#]
[AttributeUsage(AttributeTargets.All)]
public sealed class MatchAttribute : Attribute
[C++]
[AttributeUsage(AttributeTargets::All)]
public __gc __sealed class MatchAttribute : public Attribute
[JScript]
public
   AttributeUsage(AttributeTargets.All)
class MatchAttribute extends Attribute

スレッドセーフ

この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。

解説

テキストのパターン一致を使用すると、XML Web サービスで正規表現を使用して既存の HTML の内容を解析し、活用できます。XML Web サービスは、一致要素を使用してサービスの説明で解析する内容を指定します。一致要素には、既存の HTML ページの内容を解析するための正規表現、解析で大文字小文字を無視する必要があるかどうか、正規表現に一致する内容のインスタンスをいくつ返すかなど、複数の項目を指定します。クライアントが Wsdl.exe ツールを使用してプロキシ クラスを作成すると、Service Description で検出された一致要素の詳細を記述した MatchAttribute が、プロキシ クラスのメソッドに含まれます。

テキストのパターン一致の詳細については、「 Web ページのコンテンツを解析する XML Web サービスの作成 」を参照してください。

使用例

 
[C#] 
[C++] 
#using <mscorlib.dll>
#using <System.dll>
#using <System.Web.Services.dll>
using namespace System;
using namespace System::Web::Services::Protocols;
   public __gc class Example_Headers {
   public:
      [MatchAttribute(S"TITLE>(.?)<")]
      String* Title;

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

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

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

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

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

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

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

名前空間: System.Web.Services.Protocols

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

アセンブリ: System.Web.Services (System.Web.Services.dll 内)

参照

MatchAttribute メンバ | System.Web.Services.Protocols 名前空間