Parsing HTML From Chrome

  • Revision slug: Parsing_HTML_From_Chrome
  • Revision title: Parsing HTML From Chrome
  • Revision id: 54007
  • Created:
  • Creator: Nickolay
  • Is current revision? No
  • Comment update link

Revision Content

From: http://groups.google.com/group/mozil...054cb4e9fc0ed2

On 13 Nov 2006 04:43:08 -0800, Chen Zhiyuan <gsm.chenzhiyuan@gmail.com> wrote:
> It seems that the DOMParser does not support parse a html string into
> HTMLDocument? Is there a way to create the Document with a given
> string?

http://groups-beta.google.com/group/...5915ce28c35501
http://groups-beta.google.com/group/...88aa78b1eea2a5

You can use the hidden iframe trick to parse the HTML.

Firefox's microsummary service uses a hidden iframe to parse HTML. See the MicrosummaryResource object in nsMicrosummaryService.js.

Revision Source

<p>From: <a class=" external" href="http://groups.google.com/group/mozilla.dev.extensions/browse_thread/thread/55662db3ea44a198/fe054cb4e9fc0ed2#fe054cb4e9fc0ed2" rel="freelink">http://groups.google.com/group/mozil...054cb4e9fc0ed2</a>
</p>
<pre class="eval">On 13 Nov 2006 04:43:08 -0800, Chen Zhiyuan &lt;<a class=" link-mailto" href="mailto:gsm.chenzhiyuan@gmail.com" rel="freelink">gsm.chenzhiyuan@gmail.com</a>&gt; wrote:
&gt; It seems that the DOMParser does not support parse a html string into
&gt; HTMLDocument? Is there a way to create the Document with a given
&gt; string?

<a class=" external" href="http://groups-beta.google.com/group/netscape.public.mozilla.dom/browse_thread/thread/bc3a1121c18023a4/f75915ce28c35501?lnk=st&amp;q=parse+html+author%3Azbarsky&amp;rnum=2#f75915ce28c35501" rel="freelink">http://groups-beta.google.com/group/...5915ce28c35501</a>
<a class=" external" href="http://groups-beta.google.com/group/netscape.public.mozilla.dom/browse_thread/thread/126739f8904f94d9/4988aa78b1eea2a5?lnk=st&amp;q=parse+html+author%3Azbarsky&amp;rnum=1#4988aa78b1eea2a5" rel="freelink">http://groups-beta.google.com/group/...88aa78b1eea2a5</a>

You can use the hidden iframe trick to parse the HTML.
</pre>
<p>Firefox's microsummary service uses a hidden iframe to parse HTML. See the <a class="external" href="http://lxr.mozilla.org/mozilla/source/browser/components/microsummaries/src/nsMicrosummaryService.js#1696">MicrosummaryResource object in nsMicrosummaryService.js</a>.
</p>
Revert to this revision