HN user

PHP-TROLL

-13 karma
Posts0
Comments6
View on HN
No posts found.

I'm not talking about parsing HTML. I'm talking about getting data out of HTML which is completely different.

One doesn't need to guess at all possible combinations of badness using a regex, you just need to find the data you need and adjust the regex to the badness of that particular page.

Do you know anyone that mines for data out of HTML "in the wild"? I didn't think so.

Why is it better?

I think HTML parsers have their place, but I don't understand why people think regular expressions are not a valid tool for getting data out of HTML. HTML parsers are only an appropriate solution if the HTML is valid, well structured and mostly semantic.

If you are dealing with invalid, code generated via Frontpage 2000 by some bureaucrat with little HTML knowledge, regular expressions will almost always be a better option.

Yeah when I said XML parsers I was speaking generically. I tried many HTML and XML parsers as well has HTML sanitizers. They worked, maybe, 60% of the time. Hpricot regularly segfaulted, beautifulsoup didn't even begin to work. Even if I ran the HTML through tidy first it would fail to parse.

Most people are ignorant of how bad most of the HTML on the web is, it is simply unparseable.

This is total bullshit. This is assuming that you are parsing well formatted, modern HTML.

Anyone who has had to data mine HTML on a regular basis knows regular expressions are the only way to go because most web pages are clusterfucks of invalid, font-tag laden, id-less, ancient piles of shit.

Any XML parser I threw at the sites I was mining ran away crying with it's pants soaked with urine. So climb down your ivory tower, because XML parsers may be the "correct" way to get data out of HTML, but they are near worthless for most situations.

HTML+CSS=POOP 17 years ago

Bollocks to your bollocks. You're reading comprehension must be very low.

"HTML is a mark-up language for documents. Its simplicity has enabled the spread of the web. In addition it provided a means for some semantic marking BLAH BLAH BLAH."

You are repeating what he says in his blog. Maybe you read the wrong blog?

"CSS was the answer to presentational issues."

Yes, but it's not a good answer. It is possible to criticize something not as reflection of a person's own deficiencies, but because it is works poorly.

"Most important this separation enables easier indexing of web pages which is next to impossible to index with graphical based systems."

He never said the separation of content and layout is bad. He said they way that it is implemented is "POOP" Any sane person is for the seperation of content and layout.