cannot read propert documentElement from null, only Android?
I facing a problem in reading rss feeds from a website, it works good on Iphone and it was working on Android but suddenly I got this error message
TypeError: Cannot read property "documenyElemnt" from null
I've tried this solution :
delete the contents of the immediate subdirectories of /build/android,Then click the Save Changes button to force a full rebuild and launch the app
but it doesn't work
this is my code:
var xhr = Ti.Network.createHTTPClient();
var url = 'MyUrl';
xhr.open("GET", url);
xhr.onload = function(){
var doc = this.responseXML.documentElement;
var items = doc.getElementsByTagName("item");
It was working for couples of weeks , and I didn't change my code !
3 Answers
-
"responseXML" is "null". I don't know why (maybe some error occurred in fetching remote data), but that's a good point where to start searching for the error. :)
-
thank you for your corporation, now I have two URLs with the same situation, works good on Iphone but not on Android, I'll try my best to find a solution
-
solved by this code
if (this.responseXML == null) var doc = Ti.XML.parseString(this.responseData.toString()); else var doc = this.responseXML.documentElement;