Export (0) Print
Expand All

MatchAttribute Class

Represents the attributes of a match made using text pattern matching. This class cannot be inherited.

For a list of all members of this type, see MatchAttribute Members.

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

[Visual Basic]
<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

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

Text pattern matching allows an XML Web service to leverage existing HTML content by parsing it using regular expressions. an XML Web service specifies the content it wants to parse in a Service Description using match elements. These match elements specify several items: the regular expression for parsing the contents of an existing HTML page, whether the parsing must be case-insensitive, and how many instances of content that matches the regular expression should be returned. When a client builds a proxy class using the Wsdl.exe tool, methods of the proxy class include a MatchAttribute detailing the match elements found in the Service Description.

For more information on text pattern matching, see Creating XML Web Services That Parse the Contents of a Web Page.

Example

[Visual Basic] 
[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] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Web.Services.Protocols

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web.Services (in System.Web.Services.dll)

See Also

MatchAttribute Members | System.Web.Services.Protocols Namespace

Show:
© 2014 Microsoft