PDA

View Full Version : XML Parsing Producing error while the app is turned to a native app.



roymj88
13 Dec 2011, 2:50 AM
Hi,

I am developing a simple application which unfortunately for me needs access to database. While the app works perfectly while running through url, it does not work when used as an iphone app. The problem is the xml parsing is not taking place properly.




function login(){

$.ajax({
type: "GET",
url: "http://www.sicsglobal.com/projects/classapp/class-app-xml/login.xml",
dataType: "xml",
success: parseXml
});

function parseXml(xml) {

var schoolname = document.getElementById("schoolname").value;
var activation = document.getElementById("activation").value;
$(xml).find("login").each(function(){
var username = $(this).find("username").text();
var password = $(this).find("password").text();

if((schoolname==username)&&(activation==password)){
Test.Viewport.setActiveItem('second',{type:'slide', direction:'left'});
}
else{
document.getElementById('login_response').innerHTML = '<br><span style="color:#FFF">Invalid schoolname/activation code</span>';
}

});
}


}




The url does not work



url: "http://www.sicsglobal.com/projects/classapp/class-app-xml/login.xml",


Is there any way around this? I just need to compare details from database. Kindly help. All the screens are done and now only thing pending is filling up the screens with data fetched from database through xmls.

Thanks

Roy M J

mitchellsimoens
13 Dec 2011, 7:21 AM
What other than ST2 are you using? Are you loading from a different domain?

roymj88
13 Dec 2011, 8:46 AM
Hi,

I am just using Sencha touch 2. I am new to sencha and i am not sure whether i can use any of other products along with this.

The problem with my app is that when i run through browser it works fine.

But when i convert it to a native app(iphone app using xcode build), the app doesnt work. I have searched through code one line after another and then found that the code stops responding in the xml parsing part. And i am assuming when the app is converted to native app to run in a browser, the database connectivity fails.

Is there any way that i can get the database connection when the app is made to a native app.

Thanks

Roy