jaquin
27 Sep 2010, 6:33 PM
Hi all,
I am new to developing and also new to sencha touch. I was tinkering with some examples and would like to ask some help with regards to xml reader. I cant seem to read the xml file.
here's my code:
####### js file ############
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {
Ext.regModel('Node', {
fields : [
{name : 'sessionId', type : 'string'}
]
});
var store = new Ext.data.Store({
model : 'Node',
proxy : {
type : 'ajax',
url : 'test.xml',
reader : {
type : 'xml',
root : 'resp'
}
},
listeners : {
single : true,
datachanged : function() {
Ext.getBody().unmask();
store.each(function(rec) {
network.push({
sessionId : rec.get('sessionId'),
});
});
}
}
});
store.read();
}
});
######## test.xml ##########
<?xml version="1.0" encoding="UTF-8" ?>
- (http://www.sencha.com/forum/) <resp status="ok">
<sessionId>rest-5268020154968643962</sessionId>
</resp>
here is the error when i am trying to debug using chrome:
XMLHttpRequest cannot load file:///C:/Documents%20and%20Settings/user/Desktop/phone%20gap%20+%20sencha%20touch/sencha-touch-beta-0.95/sencha-touch-beta-0.95/examples/xml%20read/test.xml?_dc=1285640547346. Origin null is not allowed by Access-Control-Allow-Origin.
to those that will reply. Thank you in advance:)
I am new to developing and also new to sencha touch. I was tinkering with some examples and would like to ask some help with regards to xml reader. I cant seem to read the xml file.
here's my code:
####### js file ############
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {
Ext.regModel('Node', {
fields : [
{name : 'sessionId', type : 'string'}
]
});
var store = new Ext.data.Store({
model : 'Node',
proxy : {
type : 'ajax',
url : 'test.xml',
reader : {
type : 'xml',
root : 'resp'
}
},
listeners : {
single : true,
datachanged : function() {
Ext.getBody().unmask();
store.each(function(rec) {
network.push({
sessionId : rec.get('sessionId'),
});
});
}
}
});
store.read();
}
});
######## test.xml ##########
<?xml version="1.0" encoding="UTF-8" ?>
- (http://www.sencha.com/forum/) <resp status="ok">
<sessionId>rest-5268020154968643962</sessionId>
</resp>
here is the error when i am trying to debug using chrome:
XMLHttpRequest cannot load file:///C:/Documents%20and%20Settings/user/Desktop/phone%20gap%20+%20sencha%20touch/sencha-touch-beta-0.95/sencha-touch-beta-0.95/examples/xml%20read/test.xml?_dc=1285640547346. Origin null is not allowed by Access-Control-Allow-Origin.
to those that will reply. Thank you in advance:)