uses StrUtils, mshtml; procedure TForm1.Button1Click(Sender: TObject); function GetBetweenTags(TagStart, TagStop, HtmlText: String): string; Var P, P2: Integer; str: String; begin result := ''; P := Pos(TagStart, HtmlText); if P>0 Then begin P2 := PosEx(TagStop, HtmlText, P); if P2>0 Then result := copy(HtmlText, P+length(TagStart), P2-(P+length(TagStart))); end; end; var iall: IHTMLElement; begin if Assigned(WebBrowser1.Document) then begin iall := (WebBrowser1.Document AS IHTMLDocument2).body; while iall.parentElement <> nil do begin iall := iall.parentElement; end; showmessage(GetBetweenTags('', uppercase(iall.outerHTML))); //we use uppercase to be sure to find the tags end; end;
Get Between Tag of HTML ~ Delphi
Holooo.. cold weather make me stay on my dekstop, in my village was rain guest.. today i am trying to read the HTML of a website using the Delphi WebBrowser component. like between Target or like and this is code to find it.
0 Response to "Get Between Tag of HTML ~ Delphi"
Post a Comment