Re: A html componet



> I am in the middle of writing my own parser that will turn a
> given HTML source into an object tree. But, I dont want to
> to do it --if I can find something else that does what I
> want to do.
>
> Here it is:
>
> I have a web page that contains various numbers of tables
> (it varies due to the POSTed data).
>
> Table cells contain information that differ by the kind of
> font they are displayed (same cell can have several kinds
> of fonts --colors, fontstyle, fontname, size etc.)
>
> So, I need something a lot more intelligent than a simple
> parser that returns tags --I dont want to spend decoding
> every single tag for every single cell just to be able
> to get the text + font information. I'd like it to be
> done by a component.
>
> Can ATagParser do this?

Sure.

If you're wanting to deal with the actual attributes of
specific tags, you could use the OnAttribute event..

procedure TForm1.ATagParser1Attribute(Sender: TObject;
Attribute: TAttributeElement; var Abort: Boolean);
var
TagIndex, AttrIndex: Integer;
begin
TagIndex := FindTagID(Attribute.ParentTagHash);
Case TagIndex Of
TID_TABLE :
Begin
AttrIndex := FindAttributeID(Attribute.Hash);
Case AttrIndex Of
AID_FACE :
// Attribute.Value = font name
AID_SIZE :
// Attribute.Value = font size
End;
End;
End;
end;

Hope this helps..

John McTaggart


.



Relevant Pages

  • Re: Logic failure..
    ... I've been writting a HTML parser and ran into pretty much all the ... all the HTML tags etc. ... When a closing tag is detected, instead of recursing, I exit the ...
    (borland.public.delphi.non-technical)
  • Re: Understanding simplest HTML page
    ... These tags are required, but they're required by external good-practice ... A correct HTML parser is based around SGML practice and the HTML DTD ... Note also that your terminology of "tag pairs" is useful, ...
    (comp.infosystems.www.authoring.html)
  • Re: HTML Parser
    ... You asked for a parser. ... then the Replacing/Merging Tags demo. ... the document and replaces the tags when found. ... Bottom line - there are lots of good ways to merge information ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: any way to fix this?
    ... so are you suggesting that i remove those prepositions? ... i actually dont ... understand what you're trying to say, i personally edited all the tags ...
    (microsoft.public.windowsxp.music)
  • Re: HTMLParser question
    ... > However what I would like is that when the parser reaches some HTML like ... > I should get back the data between the open and close tags. ... Set a flag, when you the parser calls handle_starttagand the tag ... the flag is unset on the second ). ...
    (comp.lang.python)