-
15 Nov 2010 4:41 PM #1
XMLReader -> Attribute Mapping -> Ext.DomQuery?
XMLReader -> Attribute Mapping -> Ext.DomQuery?
Hi
I need to read some attributes out of an XML.
I tried several ways to get the mapping to an attribute, but didn't manage to get it working.
I ended up doing a hack which didn't work on older android devices.
XML
XmlReaderCode:<a> <b c="howto">no problem to get this text</b> <b c="bla">foo bar</b> </a>
Mappings i triedCode:record: "b", totalProperty: false, model: 'foo'
Unfortunately, non of them worked.Code:mapping: 'c' mapping: 'b[c]' mapping: '[c]' mapping: 'b[@c]' mapping: '[@c]' mapping: '[name=c]' mapping: '@c'
Does anyone has an idea? I can't change the format of the XML.
Hack on store callback which did not work on all devices i tested on:
ThxCode:for (var i = 0; i < records.length; i++){ records[i].data.c= records[i].raw.attributes.getNamedItem('c').nodeValue; };
Fredi
-
18 Nov 2010 1:57 PM #2
If somebody has the same issue:
http://www.sencha.com/forum/showthre...=xml+attribute
I don't think it's the right way because in the mapping doc of Ext.data.Field its written:
But anyway.... this solved my problem.Ext.data.XmlReader
The mapping is an Ext.DomQuery path to the data item relative to the DOM element that represents the record. Defaults to the field name.
-
23 Aug 2011 1:24 PM #3
xmlReader Attribute
xmlReader Attribute
Hello, please help me. I need to read the attribute "url" tag in the "enclosure" as trex xml below. Demonstrate the code I'm using, but do not know how to access the attribute.
The XML:
<item>
<title>::Palavra 21-08-2011</title>
<description>Domingo-21-08</description>
<enclosure url="http://download.com.br/podcast/bm/21082011.mp3" length="29896704" type="mp3" />
<pubDate>Sun 21 Aug 2011 21:00:00 -0300</pubDate>
</item>
The Code:
Ext.regModel('PAM', {
fields: ['title', 'description', 'enclosure','pubDate']
});
var pam = new Ext.data.Store({
model: 'PAM',
autoLoad:true,
proxy: {
type: 'ajax',
url : 'pam.xml',
reader: {
type : 'xml',
root : 'channel',
record: 'item'
}
}
});
Who can help, thank you.
Similar Threads
-
XmlReader mapping to XML attribute
By Davi Baldin in forum Ext 1.x: Help & DiscussionReplies: 7Last Post: 16 Jan 2012, 4:34 PM -
How to use XmlReader to map an attribute to an attribute setting on my TextField?
By jscolton in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 1 Nov 2009, 8:10 AM -
Question about DomQuery for Ext.data.XmlReader
By tomcheng76 in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 28 Mar 2008, 2:03 AM -
select attribute for id in Ext.data.XmlReader
By weee in forum Ext 2.x: Help & DiscussionReplies: 3Last Post: 31 Jan 2008, 2:25 AM -
DomQuery _nodup attribute
By INeedADip in forum Ext 1.x: BugsReplies: 1Last Post: 22 Jun 2007, 10:39 AM


Reply With Quote