Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-12

FastHtmlParser does not fire OnFoundText on e.g. empty table cell

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

Hi,

If you parse HTML using FastHtmlParser in order to extract a HTML table content, then, if a table contains an empty cell (<td></td>), the OnFoundText event is not fired.
While technically this may be correct, I would have expected it to fire OnFoundText('').

In my program I use the OnFoundText to populate a 2-dimesional table-like structure, and this fails due to this behaviour of FastHtmlParser.

Is this intended behaviour?
If so, could it be made configurable to do fire the OnFoundText event in such cases?

Bart

Reply by email

Bart
to Bart
Bart wrote
Is this intended behaviour? If so, could it be made configurable to do fire the OnFoundText event in such cases?

Never mind, I did not think this through.
I solved my problem in a better way (it should never have depended on the OnFoundText event in the first place).

Sorry for wasting your time.

Bart

Reply by email

Graeme Geldenhuys
to Bart: If you parse HTML using FastHtmlParser in order to extract a HTML table content, then, if…
Bart wrote
Is this intended behaviour?

I'm not sure. I used FastHTMLParser 2+ months ago and discovered a couple of bugs in it, and similar behaviour to what you mentioned. I wrote some unit tests for it and fixed the bugs I found. I'll make a not to publish my changes and test suite.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Lars
to Bart: Never mind, I did not think this through. I solved my problem in a better way (it should…
Bart wrote 14 lines
On 12/29/16, Bart wrote: > Is this intended behaviour? > If so, could it be made configurable to do fire the OnFoundText event > in such cases? Never mind, I did not think this through. I solved my problem in a better way (it should never have depended on the OnFoundText event in the first place). Sorry for wasting your time.

This brings some kind of Deja Vu as I may have had a similar issue once upon a time... but cannot remember ;-)

Reply by email

Lars
to Graeme Geldenhuys: I'm not sure. I used FastHTMLParser 2+ months ago and discovered a couple of bugs in it,…
Graeme Geldenhuys wrote 10 lines
On 2016-12-29 18:43, Bart wrote: > Is this intended behaviour? > I'm not sure. I used FastHTMLParser 2+ months ago and discovered a couple of bugs in it, and similar behaviour to what you mentioned. I wrote some unit tests for it and fixed the bugs I found. I'll make a not to publish my changes and test suite.

I have plans to put fast html parser on an official git hub so that any issues can be reported centrally

Thanks for finding bugs (assuming they are not just technicalities as Bart was saying)

Reply by email

Graeme Geldenhuys
to Bart
Bart wrote
I thought it was part of fpc packaes source

Correct, it is now included with FPC. The problem being, I found 3 different copies in the various FPC packages. I've asked Michael van Canneyt if we can consolidate the various fasthtmlparser units into one location, and let the various FPC packages use that one copy instead. He agreed, but I haven't submitted a patch for that yet. It's on my todo list.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email