View Issue Details

IDProjectCategoryView StatusLast Update
0002007JEDI VCL00 JVCL Componentspublic2004-09-25 02:20
ReporteranonymousAssigned Touser72 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version3.00 RC 1 
Summary0002007: HTMLParser eventless tag parsing
DescriptionHey,

It would be great if the HTML Parser component could parse the page in a loop rather than using events to grab the tags.
And also output easily usable tag properties.

For example:

While HtmlParser.DoParse do
begin
   if HtmlParser.HtmlTag.Caption = 'input' then
   begin
      ShowMessage(HtmlParser.HtmlTag.Property['name']);
      ShowMessage(HtmlParser.HtmlTag.Property['value']);
      ShowMessage(HtmlParser.HtmlTag.Property['type']);
   end;
end;

That would loop until the we reach the EOF.

Sometimes you really need to do the parsing and only then start using the results, unlike the current method which is even driven, and still makes you do a bit of parsing yourself (parse attribues yourself).

Thanks!
TagsNo tags attached.

Activities

user72

2004-08-04 07:29

  ~0004927

I've attached a very simple tag parser to this post. Try it out and see if it works for you. I only just whipped it together quickly and haven't spent more than 15 minutes on it, so it could probably be improved a lot but it should work nicely as a starting point.

user72

2004-08-04 14:53

  ~0004931

I've attached an updated JvHTMLTagParser including a demo that shows its use.

Note that the parser doesn't really differentiate between different tag types (i.e start tags, end tags, comments, processing instructions etc) but just output them as is. The demo shows how you can handle these situations easily.

In addition, note that any tag type can have content since the content is parsed after seeing a ">" in the input stream up until the next "<".

2004-08-04 15:18

 

JvHTMLTagParser.zip (17,324 bytes)

anonymous

2004-08-05 11:58

viewer   ~0004938

thanks peter3, I've tried the demo and it worked ;)

Issue History

Date Modified Username Field Change
2004-07-28 06:13 anonymous New Issue
2004-08-04 07:27 user72 File Added: JvHTMLTagParser.pas
2004-08-04 07:29 user72 Note Added: 0004927
2004-08-04 14:44 user72 File Deleted: JvHTMLTagParser.pas
2004-08-04 14:44 user72 File Added: JvHTMLTagParser.zip
2004-08-04 14:53 user72 Note Added: 0004931
2004-08-04 15:18 user72 File Added: JvHTMLTagParser.zip
2004-08-04 15:18 user72 File Deleted: JvHTMLTagParser.zip
2004-08-05 11:58 anonymous Note Added: 0004938
2004-09-25 02:20 user72 Status new => resolved
2004-09-25 02:20 user72 Resolution open => fixed
2004-09-25 02:20 user72 Assigned To => user72