Reputation: 678
I use ExtJS 4.2. What is the easiest way to read local XML file? I understand that it's possible to use store and model, but I prefer other way. Is it possible to use Ext.Ajax.Request?
For example, this is my XML file content:
<LocaleText>
<Item>
<CTRO_CONTROLID>lblLoginTitle</CTRO_CONTROLID>
<CTRO_CONTROLTYPE>label</CTRO_CONTROLTYPE>
</Item>
<Item>
<CTRO_CONTROLID>cboLoginLanguage</CTRO_CONTROLID>
<CTRO_CONTROLTYPE>combobox</CTRO_CONTROLTYPE>
</Item>
</LocaleText>
How can I get the data of each Item node?
Upvotes: 2
Views: 3954
Reputation: 2245
response.responseXML
in the Ext.Ajax.request
for getting the xml type response.Ext.DomQuery
class for getting data out from an xmlExample:
Ext.Ajax.request({
url: '/your/url/here/test.xml',
success: function (response, options) {
var object = response.responseXML;
var test = Ext.DomQuery.select('Item', object);
console.log('test', test);
}
});
Upvotes: 3