Can someone help me solve this (and save me alot of time). Problem:
push button to scrape element values from stock market page and copy
the info to the clipboard. The info is pasted to a database and
parsed etc.
I am using the function below to (hopefully) convert HTML page into
DOM and extract attribute values from the DOM elements <div>'s etc.
The function comes from
https://developer.mozilla.org/en-US/docs/Code_snippets/HTML_to_DOM.
Example of the page I am looking at is to extract info is:
http://finance.yahoo.com/q?s=GTN&ql=1 ( searching like
getElementById("yfs_l84_gtn") )
function HTMLParser(aHTMLString){
var html = document.implementation.createDocument("
http://www.w3.org/
1999/xhtml", "html", null),
body = document.createElementNS ("
http://www.w3.org/1999/xhtml",
"body");
html.documentElement.appendChild(body);
body.appendChild(Components.classes["@
mozilla.org/feed-unescapehtml;
1"]
.getService(Components.interfaces.nsIScriptableUnescapeHTML)
.parseFragment(aHTMLString, false, null, body));
return html;
}
Thanks for any help provided
Phil Dickson