Hi. I have been searching the forums and docs for the last couple of days and am having a hard time figuring out how to do this with XMLReader. I am attempting to access all the presenters from the following xml.
PHP Code:
<results>
<result>
<title>Monthly Review - Getting Started</title>
<mediaUrl></mediaUrl>
<mediaAbstract>Getting Started</mediaAbstract>
<durationHours>0</durationHours>
<durationMinutes>16</durationMinutes>
<category>Meetings</category>
<accessLevel>engineering</accessLevel>
<presenters>
<presenter>
<lastName>doe</lastName>
<firstName>john</firstName>
<biography/>
</presenter>
<presenter>
<lastName>roberts</lastName>
<firstName>bob</firstName>
<biography/>
</presenter>
</presenters>
</result>
</results>
Here is the js.
PHP Code:
var ds = new Ext.data.Store({
remoteSort: true,
proxy: new Ext.data.HttpProxy({
url: '/wsproxy_media.pl'
}),
reader: new Ext.data.XmlReader({
root: 'results',
totalProperty: '@total',
record: 'result',
}, [
{name: 'title', mapping: 'title'},
{name: 'url', mapping: 'mediaUrl'},
{name: 'abstract', mapping: 'mediaAbstract'},
{name: 'hours', mapping: 'durationHours'},
{name: 'minutes', mapping: 'durationMinutes'},
{name: 'category', mapping: 'category'},
{name: 'presenter', mapping: 'presenters > presenter > firstName'}
]),
baseParams: {q:q, start: 0, limit:pageSize}
});
// Custom rendering Template for the View
var resultTpl = new Ext.XTemplate(
'<tpl for=".">',
'<div class="yui-g" style="padding-top: 5px;">',
'<div class="yui-u first" style="width: 70%;">',
'<div style="border-right: 1px dotted #333333; padding-right: 5px; padding-left: 5px;">',
'<p><a href="{url}" class="autoIconMEDIA" target="_blank">{title}</a></p>',
'<p>{abstract}</p>',
'</div>',
'</div>',
'<div class="yui-u" style="width: 30%;">',
'<div style="padding-left: 10px;">',
'<div>Date: {datePosted}</div>',
'<div>Duration: {hours} hours {minutes} minutes</div>',
'<div>Presenters: {presenter}</div>',
'<div>Category: <a href="#" onclick="searchViaLink(\'{category}\');">{category}</a></div>',
'</div>',
'</div>',
'</div>',
'<div class="horizontal-dots-gray"></div>',
'</tpl>'
);
I know that this only displays the presenters first name because I am just walking down the xml and I believe its grabbing the last presenter. How do I get all of them? I have seen some solutions that require editing the XMLReader source. Unfortunately I am in a large corporation that uses ext js so I don't have access to the source. Any help would be really appreciated.