Imports System
Imports System.Web.Services.Protocols
Public Class MatchAttribute_Example
Inherits HttpGetClientProtocol
Public Sub New()
Url = "http://localhost"
End Sub 'New
<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 'MatchAttribute_Example
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 'Headers
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;
}
#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 ));
}
};