View Full Version : Parse XML data question

4 Feb 2014, 5:53 AM
Hi All,
I have given my XML and code read the XML below.
My requirement is, how do i print all 'components' if give "XXXUpdate" as input? Can someone help me with this?

<menus name="XXX">
<Permission name="XXXUpdate">
<component name="Save">savebuttonid</component>
<component name="add">addbuttonid</component>
<component name="accesscode">accesscode button id</component>

<Permission name="XXXRestore">
<component name="restore">restorebuttonid</component>


Ext.define('User', {
extend: 'Ext.data.Model',
fields: ['Permission','component']

var store = Ext.create('Ext.data.Store', {
model: 'User',
proxy: {
type: 'ajax',
url : 'Test2.xml',
reader: {
type : 'xml',
model: 'User',
record: 'menus',
root: 'access'
}, listeners:{
load:function(store, recs, successful, eOpts) {

//print records here


6 Feb 2014, 12:50 PM
With irregular data structures you will often want to use a function in your field mapping (there is a request internally to get functions as values for mapping added to the API docs).

You can do something like:


6 Feb 2014, 1:10 PM
Or, if all you needed was the components and not really the permission info you might do something like: