1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    21
    Vote Rating
    3
    Answers
    1
    Svinja is on a distinguished road

      0  

    Default Unanswered: Ext.DomQuery attribute selector problem with xml

    Unanswered: Ext.DomQuery attribute selector problem with xml


    Hi,

    i am trying to parse this simple xml:
    HTML Code:
    <?xml version="1.0" encoding="utf-8"?><rss version="2.0">
        <channel>        
            <item>
                <title>Title 1</title>
                <image url="imageUrl">
                    <description>Image description</description>
                </image>
            </item>
        </channel>
    </rss>
    with this code:
    Code:
    Ext.define('MyApp.model.NewsItem', 
    {
        extend: 'Ext.data.Model',
    
    
        config: 
        {
            fields: 
            [
                {name: 'title',  type: 'string'},
                {name: 'imageDescription', type: 'string', mapping:'image>description'},
                {name: 'imageUrl', type: 'string', mapping:'image[url]'}
    
    
            ]
        }
    });
    All is fine except imageUrl is empty. It is interesting that it is empty and not null.
    Reference: http://docs.sencha.com/touch/2-0/#!/api/Ext.DomQuery
    Any help is appreciated.
    Thx.

  2. #2
    Sencha User MD's Avatar
    Join Date
    Mar 2007
    Posts
    178
    Vote Rating
    0
    MD is on a distinguished road

      0  

    Default


    image[url] select 'image' elements that have an attribute named 'url'. So it's just selecting your image node(s), not mapping to the value of the url attribute, which I assume is what you're going for.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    21
    Vote Rating
    3
    Answers
    1
    Svinja is on a distinguished road

      0  

    Default


    yes, that was my last attempt, but "image > @url" or "image / @url" should work i think but it doesnt...

Thread Participants: 1