Parse simple HTML Tables – embarcadero.delphi.xml

like this:

<TABLE cellpadding=3 cellspacing=0 width="100%"><TR><TD align="right" 
class="cartbasic"><P class="smallfade">First name</P></TD><TD 
class="cartbasic"><P>Peter</P></TD></TR>
<TR><TD align="right" class="cartbasic"><P class="smallfade">Last 
name</P></TD><TD class="cartbasic"><P>Smith</P></TD></TR>
<TR><TD align="right" class="cartbasic"><P 
class="smallfade">Address</P></TD><TD class="cartbasic"><P>Home street 
46</P></TD></TR>
<TR><TD align="right" class="cartbasic"><P 
class="smallfade">ZIP</P></TD><TD class="cartbasic"><P>87300</P></TD></TR>
</TABLE>

and the information taken out from there looks like this:

  First name  Peter
  Last name   Smith
  Address     Home street 46
  ZIP         87300

So, are there any obvious, simple HTML parse algorithms available for 
Delphi that could do this?

There are a lot of HTML-parsers in general. I have studied for instance 
the parsing code from this free Browser component:
http://pbear.com/htmlviewers.html.
Medical science has http://raindogscine.com/?attachment_id=91 generico levitra on line invented many solutions for this. Sweating during exercise viagra on line cheap  helps rid the body of waste. You must be wondering now what is Nitric oxide? Nitric Oxide itself can be the name levitra buy online  for a simple free form chemical gas produced in the human body as a messenger between cells. Systemic Inflammation In COPD cialis online pill  Sets Up Depression And Anxiety Depression and anxiety are common in COPD, which occur in Parkinson's disease. After two days of studying, I have to admit that I can't get a grab of 
this parser. I do not get how to use this nice HTML-tool to parse data 
from my Html-tables. The code is far too advanced and complicated for my 
tiny need.

I also found that TWebBrowser component would be able to parse those 
HTML-tables, like this:

procedure TForm1.Button1Click(Sender: TObject);
var
  i, j: Integer;
  ovTable: OleVariant;
begin
  ovTable := WebBrowser1.OleObject.Document.all.tags('TABLE').item(0);
  for i := 0 to (ovTable.Rows.Length - 1) do
  begin
    for j := 0 to (ovTable.Rows.Item(i).Cells.Length - 1) do
    begin
      StringGrid1.Cells[j+1, i+1] :=
        ovTable.Rows.Item(i).Cells.Item(j).InnerText;
    end;
  end;

This way the data goes nicely go TStringGrid.

 

Leave a Reply