<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Html on Johnny Huang</title><link>https://hzqtc.github.io/tags/html/</link><description>Recent content in Html on Johnny Huang</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 18 Apr 2013 00:00:00 +0000</lastBuildDate><atom:link href="https://hzqtc.github.io/tags/html/index.xml" rel="self" type="application/rss+xml"/><item><title>Event Based HTML Parsing with Python</title><link>https://hzqtc.github.io/2013/04/event-based-html-parsing.html</link><pubDate>Thu, 18 Apr 2013 00:00:00 +0000</pubDate><guid>https://hzqtc.github.io/2013/04/event-based-html-parsing.html</guid><description>&lt;p&gt;HTML parsing is a useful technique for crawlers. Three major techniques to parse&#10;HTML are regular expression, tree-model based parsing and event based parsing.&#10;Regular expression is universally applicable for all parsings, but it&amp;rsquo;s tricky&#10;and hard for other people to understand or even maintain.&lt;/p&gt;&#10;&lt;p&gt;Tree-model based parsing is powerful and popular, a lot of HTML/XML parsing&#10;libraries construct an in-memory tree-like model to represent the structure of&#10;the parsed HTML. The first drawback of this kind of parsing is obvious,&#10;constructing tree-models in memory requires memory for the entire HTML even if&#10;we only need a small part of it. The second problem of tree-model based parsing&#10;is the cost of CPU time. If a big HTML file is parsed and the in-memory model is&#10;huge, a lot of CPU time is cost to build the model and travel in the model.&lt;/p&gt;</description></item></channel></rss>