Sencha-Touch-2 – Sencha Touch 2, Nested XML Analysis NodeValue

I use nested XML and parse it with’hasMany’. If anyone can tell me how to read the value of node’‘, I would appreciate it. I can easily Read the attribute’id’ and & use the mapped’val’, but I also want to read the node value, for example. 257411 in
< type id = "3" val = "0"> 257411
If anyone can Provide a suitable “mapping”, I would appreciate it

XML data:



302221

257411
28213
8645
3664
2246< /type>
1124
918

Model Basic
Ext.define( “ap3.model.Basic”,{
extend: “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”,{
extend: “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'
}
}
}

< p>});

“mapping” also accepts a function:

{name:'id', mapping:'@id'},
{name:'name', mapping:'@name'},
{name:'number', mapping: function (node) {
return (node.firstChild? node.firstChild.nodeValue: null );
}}

I use nested XML and use’hasMany’ to parse it. If anyone can tell me how to read the node’ ‘Value, I would appreciate it. I can easily read the attribute’id’ and & use the mapped’val’, but I also want to read the node value, for example. 257411 in
< type id = "3" val ="0"> 257411
If someone can provide a suitable “mapping”, I would be very grateful.

XML data:

 

302221

257411
28213< br /> 8645
3664
2246
1124
918

Model Basic
Ext.define( “ap3.model.Basic”,{
extend: “Ext.data.M odel”,

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”,{
extend: “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'
}
}
}

});

“mapping” also accepts a function:

{name:'id', mapping:'@id' },
{name:'name', mapping:'@name'},
{name:'number', mapping: function (node) {
return (node.firstChild? node .firstChild.nodeValue: null);
}}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5998 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.