How do I parse events from an HTML page?

To parse any ASP, HTML or XHTML page for events is as simple as watching the OnAttribute event for the IsEvent flag, OR the HasEvent property of the OnTag event.


ComplexFilters settings

cfParseAttributes = True  
 
Elements settings
etAttribute = True  
etComplexTag = True  


Example 1:

{ In the OnAttribute event - the preferred method! }

procedure TForm1.ATagParserAttribute(Sender: TObject;
  Attribute: TAttributeElement; var Abort: Boolean);
begin
  If Attribute.IsEvent Then
    ShowMessage('This is an event: '
 + Attribute.Name);
end;


Example 2:

{ In the OnTag event }
procedure TForm1.ATagParserTag(Sender: TObject; Tag: TTagElement;
  var Abort: Boolean);
begin
  If Tag.ElementType In [etComplexTag, etXHTMLTag] Then
    If Tag.HasEvent Then
      ShowMessage('This tag has an event associated with it'
);    
end;


Copyright 2000 - 2006 John E McTaggart - All rights reserved worldwide