home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2005 March
/
PCWorld_2005-03_cd.bin
/
komunikace
/
kmeleon
/
kmeleon09.exe
/
aggreg8.jar
/
content
/
getrss.js
< prev
next >
Wrap
Text File
|
2004-11-30
|
2KB
|
76 lines
function httpGet(aURL){
if(rssLoading){
httpReq.abort();
rssLoading = false;
}
responseXML = null;
httpReq = new XMLHttpRequest();
httpReq.onload = httpLoaded;
httpReq.onerror = httpError;
httpReq.onreadystatechange = httpReadyStateChange;
try{
httpReq.open("GET" , aURL);
httpReq.setRequestHeader("User-Agent", USER_AGENT);
httpReq.overrideMimeType("application/xml");
}catch(e){
//httpGetResult(RESULT_ERROR_FAILURE);
aggreg8dump("RESULT_ERROR_FAILURE");
Parser(RESULT_ERROR_FAILURE,responseXML);
}
try{
httpReq.send(null);
rssLoading = true;
}catch(e){
//httpGetResult(RESULT_ERROR_FAILURE);
aggreg8dump("RESULT_ERROR_FAILURE");
Parser(RESULT_ERROR_FAILURE,responseXML);
}
}
function httpError(e){aggreg8dump(e);}
function httpReadyStateChange(){
if(httpReq.readyState == 2){
try{
if(httpReq.status == 404){
aggreg8dump("RESULT_NOT_FOUND");
Parser(RESULT_NOT_FOUND,responseXML);
//httpGetResult(RESULT_NOT_FOUND);
}
}catch(e){
aggreg8dump("RESULT_NOT_AVAILABLE");
Parser(RESULT_NOT_AVAILABLE,responseXML);
//httpGetResult(RESULT_NOT_AVAILABLE);
return;
}
}else if(httpReq.readyState == 3){}
}
function httpLoaded(e){
responseXML = httpReq.responseXML;
var rootNodeName = responseXML.documentElement.localName.toLowerCase();
switch(rootNodeName){
case "parsererror":
// XML Parse Error
Parser(RESULT_PARSE_ERROR,responseXML);
break;
case "rss":
case "rdf":
case "feed":
aggreg8dump("Sending to Parser" + responseXML);
Parser(RESULT_OK,responseXML);
break;
default:
// Not RSS or ATOM
Parser(RESULT_NOT_RSS,responseXML);
break;
}
}