Hi,
I am facing very strange issue in parsing xml. XML parsing fails to parse the xml response on the first loading of application in the ipad simulator as well as device. If I completely quit the application and if reopen it, it works!!!!
On the very first load of application I am getting the following error in the Titanium Appcelerator.
[WARN] Exception in event callback. { expressionBeginOffset = 6394; expressionCaretOffset = 6430; expressionEndOffset = 6435; line = 135; message = "Result of expression 'xmlDoc.getElementsByTagName(\"Count\")' [null] is not an object."; name = TypeError; sourceId = 200357448; sourceURL = "file://localhost/Users/manaday.mavani/Library/Application%20Support/iPhone%20Simulator/4.2/Applications/572185D6-43A5-458F-8D47-B5EE0A6D3C41/IRApp.app/Helper/Helper.js"; } [WARN] Exception in event callback. { expressionBeginOffset = 10019; expressionCaretOffset = 10058; expressionEndOffset = 10063; line = 211; message = "Result of expression 'xmldoc.getElementsByTagName(\"Snapshot\")' [null] is not an object."; name = TypeError; sourceId = 200357448; sourceURL = "file://localhost/Users/manaday.mavani/Library/Application%20Support/iPhone%20Simulator/4.2/Applications/572185D6-43A5-458F-8D47-B5EE0A6D3C41/IRApp.app/Helper/Helper.js"; }after quitting and relaunching the app works perfectly.
Thanks in advance.
1 Answer
the first thing I would do is call your handler on the onload event and not the onreadystatechange event, it is a common approach in most httpClient samples I have seen.
change this
snapshotxhr.onreadystatechange = handler;to this
snapshotxhr.onload = handler;
Your Answer
Think you can help? Login to answer this question!