1. #1
    Ext User
    Join Date
    Dec 2007
    Posts
    4
    Vote Rating
    0
    Aigu is on a distinguished road

      0  

    Cool 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
    Code:
    <a>
    	<b c="howto">no problem to get this text</b>
    	<b c="bla">foo bar</b>
    </a>
    XmlReader
    Code:
    record: "b",
    totalProperty: false,
    model: 'foo'
    Mappings i tried
    Code:
    mapping: 'c'
    mapping: 'b[c]'
    mapping: '[c]'
    mapping: 'b[@c]'
    mapping: '[@c]'
    mapping: '[name=c]'
    mapping: '@c'
    Unfortunately, non of them worked.
    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:
    Code:
    for (var i = 0; i < records.length; i++){
    	records[i].data.c= records[i].raw.attributes.getNamedItem('c').nodeValue;
    };
    Thx
    Fredi

  2. #2
    Ext User
    Join Date
    Dec 2007
    Posts
    4
    Vote Rating
    0
    Aigu is on a distinguished road

      0  

    Default


    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:

    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.
    But anyway.... this solved my problem.

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Posts
    4
    Vote Rating
    0
    Arnom Maciel is on a distinguished road

      0  

    Default 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

  1. XmlReader mapping to XML attribute
    By Davi Baldin in forum Ext 1.x: Help & Discussion
    Replies: 7
    Last Post: 16 Jan 2012, 4:34 PM
  2. Replies: 0
    Last Post: 1 Nov 2009, 8:10 AM
  3. Question about DomQuery for Ext.data.XmlReader
    By tomcheng76 in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 28 Mar 2008, 2:03 AM
  4. select attribute for id in Ext.data.XmlReader
    By weee in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 31 Jan 2008, 2:25 AM
  5. DomQuery _nodup attribute
    By INeedADip in forum Ext 1.x: Bugs
    Replies: 1
    Last Post: 22 Jun 2007, 10:39 AM

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."