2 ms·
Back in the day when I was in school, and there was a IE monopoly, I wrote a simple HTML parser. Instead of parsing it into a tree, it just recorded the beginni
by captainmuon 4y ago
Back in the day when I was in school, and there was a IE monopoly, I wrote a simple HTML parser. Instead of parsing it into a tree, it just recorded the beginning and end position of tags as indicies into the string. I think I did use a stack to match nested tags properly. But overlapping markup was common back then, and IE rendered it "correctly" IIRC. This simple parser was enough to power a scraper (I don't remember what I was scraping. Maybe a competitor's emule link site or something like that :-P) and a crude rich text renderer, which I was very proud of.