I am using a nested XML file and parsing it with "hasMany". I would appreciate if anyone could tell me how to read a value of type node '< >. I can easily read the attributes 'id' and 'val' of '' using mapping, but I also want to read the value of node, for example. 257411 in < type id = "3" val = "0"> 257411 I would appreciate if anyone could provide a suitable "mapping"
XML data:
<?xml version="1.0" encoding="ISO-8859-1"?> <basics id="744" name="social"> <number>302221</number> <types> <type id="3" val="0">257411</type> <type id="2" val="1081337">28213</type> <type id="1" val="263258">8645</type> <type id="5" val="0">3664</type> <type id="4" val="0">2246</type> <type id="9" val="0">1124</type> <type id="10" val="0">918</type> </types> </basics>
Basic Ext.define model ("ap3.model.Basic", {expand: "Ext.data.Model",
config: { fields: [ {name: 'id', mapping: '@id'}, {name: 'name', mapping: '@name'}, {name: 'number', mapping: 'number'} ], associations: [ { type: 'hasMany', model: 'apv3.model.Type', associationKey: 'types' }] }
});
model Type Ext.define ("ap3.model.Type", {expand: "Ext.data.Model",
config: { fields: [ {name: 'id', mapping: '@id'}, {name: 'val', mapping: '@val'}, {name: 'type', mapping: 'type'} ], proxy: { type: 'memory', reader: { type: 'xml', record: 'type' } } }
});
source share