[Greasemonkey] Parsing html - another way
Hrvoje Prgeša
hrvoje.prgesa at fer.hr
Mon Mar 20 03:50:33 EST 2006
Since I don't like using iframes or innerHTML for loading and parsing
html (and I couldn't get it to work for the pages I needed it) I made
another way to do it:
I made a simple XPCOM object in C++ (50 lines of code) that I can call
from my extension javascript - it accepts normal html and forwards it to
"Tidy HTML" library which converts it to XHTML/XML. From there on I can
use the normal DOMParser or anything else :)
I might work in GM too if you can execute something like this (this
works in a normal extension - I have no idea how GM works):
const cid = "@mipis.hr/HtmlHelpers/HtmlToXml;1"
var obj = Components.classes[cid].createInstance();
obj = obj.QueryInterface(Components.interfaces.IHtmlToXml);
var pureXHtml = obj.convertHtmlToXml(html);
So if anyone is interested...
Preview - vBulletin forum "first post" preview on icon mouseover:
http://img226.imageshack.us/img226/8008/dfifox6pi.jpg
H.
More information about the Greasemonkey
mailing list