[Greasemonkey] gm_httprequest (sp?) and parsing html files
Tod Beardsley
todb at planb-security.net
Wed Sep 6 12:05:43 EDT 2006
On 9/6/06, s g <junkvendoremail at yahoo.com> wrote:
> the gm_httprequest function returns the html page
> as a string...right?
>
> can this be parsed into a dom tree?
>From a version of BookBurro:
function str2xml(strXML) {
//create a DOMParser
var objDOMParser = new DOMParser();
//create new document from string
var objDoc = objDOMParser.parseFromString(strXML, "text/xml");
return objDoc;
}
[...then later...]
GM_xmlhttpRequest({ method:"POST",
url:'http://xml.amazon.com/onca/xml3?t=' + amazon_associate_code +
'&dev-t=' + amazon_dev_key +
'&type=lite&f=xml&mode=books&AsinSearch='+isbn, data:"",
onload:function(result) {
var x = str2xml( result.responseText );
var ourprices = x.getElementsByTagName('OurPrice');
--
planb-security.net | ICQ: 335082155 | Note: Due to Google's privacy
policy <http://tinyurl.com/5xbtl> and the United States' policy on
electronic surveillance <http://tinyurl.com/muuyl>, please do not
IM/e-mail me anything you wish to remain secret or private.
More information about the Greasemonkey
mailing list