Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002007 [JEDI VCL] 00 JVCL Components feature always 2004-07-28 06:13 2004-09-25 02:20
Reporter anonymous View Status public  
Assigned To user72
Priority normal Resolution fixed  
Status resolved   Product Version
Summary 0002007: HTMLParser eventless tag parsing
Description Hey,

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!
Additional Information
Tags No tags attached.
Attached Files zip file icon JvHTMLTagParser.zip [^] (17,324 bytes) 2004-08-04 15:18

- Relationships

-  Notes
(0004927)
user72
2004-08-04 07:29

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.
(0004931)
user72
2004-08-04 14:53

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 "<".
(0004938)
anonymous (viewer)
2004-08-05 11:58

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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker