Answers.Body: <p>I'm unable to view the feed via the link you've provided - seems like it may not allow public access. In any case, see a working example below using an example public RSS feed.</p>
  
  <pre><code>{% set params = {
      url: 'http://www.feedforall.com/sample.xml',
      type: 'xml',
      element: 'item',
  } %}
  
  {% set feed = craft.feedme.feed(params) %}
  
  {% for node in feed %}
    {{ node.category.attributes.domain }}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-21T14:15:27.937Z
Answers.Text: Hmm, I see that the feedforall xml file is displayed in Chrome as an xml file. With expandable nodes. However in my own rss feed it's not rendered that way. Maybe that might be the issue. I updated my original post with a screenshot of my feed as opened in Chrome.
Answers.UserDisplayName: Kenny Bones
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-21T14:27:57.710Z
Answers.Text: Yeah, I saw the same too - now that makes sense. Thats just likely the way its outputted. It _may_ have something to do with it - it also could be that there is no inner-value for the `enclosure` node, so it ignores it. I'll have a test.
Answers.UserDisplayName: crawf
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-21T15:17:59.400Z
Answers.Text: You were right, it was that some of the enclosure nodes was empty. I added a filter `{{ node.enclosure.attributes.url|default('empty') }}`. And it's working now :)
Answers.UserDisplayName: Kenny Bones
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-21T15:21:21.103Z
Answers.Text: Awesome - I'll try to work this into the plugin - normally it would skip over nodes without an inner value, but it'll also need a check in there for attributes. Thanks!
Answers.UserDisplayName: crawf
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-21T14:04:05.400Z
Answers.LastActivityDate: 2015-10-21T14:04:05.400Z
Answers.UserDisplayName: crawf
Body: <p>So I'm using FeedMe to get RSS atom feeds and this is working O.K. But there's this field that has an attribute I want to extract. And I cannot get this to work. </p>
  
  <p>In the FeedMe documentation it says:</p>
  
  <pre><code>For example, the XML &lt;field my_attribute="Some Value"&gt;Another Value&lt;/field&gt;, 
  you can use {{ xml.field.attributes.my_attribute }}.
  </code></pre>
  
  <p>My field is called <code>'enclosure'</code> and has an attribute called <code>'url'</code> that I want to extract. According to the documentation, one would assume that this should work:</p>
  
  <pre><code>{% set feed = craft.feedme.feed(myfeed_rss) %}
  
  {% for node in feed %}
  
      {
          'title': {{ node.title | raw }},
          'description': {{ node.description | raw }},
          'url': {{ node.link | raw }},
          'date': {{ node.pubdate | raw }},
          'image': {{ node.enclosure.attributes.url | raw }}
      }
  
  {% endfor %}
  </code></pre>
  
  <p>Namely <code>{{ node.enclosure.attributes.url }}</code> should work? All the other fields are collected correctly. So it's just this one. </p>
  
  <p>Edit: Btw, the feed I'm using is this one. 
  <a href="http://www.adressa.no/?widgetName=polarisFeeds&amp;widgetId=3185248&amp;getXmlFeed=true" rel="nofollow noreferrer">http://www.adressa.no/?widgetName=polarisFeeds&amp;widgetId=3185248&amp;getXmlFeed=true</a></p>
  
  <p>Edit2: Managed to get it to work, with help from <a href="https://craftcms.stackexchange.com/users/632/crawf">crafw</a>. Some of the nodes weren't empty, fixed it by changing the line to:</p>
  
  <pre><code>{{ node.enclosure.attributes.url|default('empty') }}
  </code></pre>
  
  <p><a href="https://craftcms.stackexchange.com/users/632/crawf">https://craftcms.stackexchange.com/users/632/crawf</a></p>
  
  <p><a href="https://i.sstatic.net/jBU9v.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jBU9v.jpg" alt="RSS feed"></a></p>
  
Tags: <templating><rss><plugin-feedme>
Title: FeedMe - Extracting attribute from an RSS feed field
ThreadText: # FeedMe - Extracting attribute from an RSS feed field
  
  (Asked by: username_0 on 2015-10-21)
  
  So I'm using FeedMe to get RSS atom feeds and this is working O.K. But there's this field that has an attribute I want to extract. And I cannot get this to work.
  
  In the FeedMe documentation it says:
  
  ```
  For example, the XML <field my_attribute="Some Value">Another Value</field>, 
  you can use {{ xml.field.attributes.my_attribute }}.
  
  ```
  
  My field is called `'enclosure'` and has an attribute called `'url'` that I want to extract. According to the documentation, one would assume that this should work:
  
  ```
  {% set feed = craft.feedme.feed(myfeed_rss) %}
  
  {% for node in feed %}
  
      {
          'title': {{ node.title | raw }},
          'description': {{ node.description | raw }},
          'url': {{ node.link | raw }},
          'date': {{ node.pubdate | raw }},
          'image': {{ node.enclosure.attributes.url | raw }}
      }
  
  {% endfor %}
  
  ```
  
  Namely `{{ node.enclosure.attributes.url }}` should work? All the other fields are collected correctly. So it's just this one.
  
  Edit: Btw, the feed I'm using is this one.
  <http://www.adressa.no/?widgetName=polarisFeeds&widgetId=3185248&getXmlFeed=true>
  
  Edit2: Managed to get it to work, with help from [crafw](https://craftcms.stackexchange.com/users/632/username_1). Some of the nodes weren't empty, fixed it by changing the line to:
  
  ```
  {{ node.enclosure.attributes.url|default('empty') }}
  
  ```
  
  <https://craftcms.stackexchange.com/users/632/username_1>
  
  [![RSS feed](https://i.sstatic.net/jBU9v.jpg)](https://i.sstatic.net/jBU9v.jpg)
  
  **Tags:** templating, rss, plugin-feedme
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-10-21. Score: 3 | Accepted answer
  
  I'm unable to view the feed via the link you've provided - seems like it may not allow public access. In any case, see a working example below using an example public RSS feed.
  
  ```
  {% set params = {
      url: 'http://www.feedforall.com/sample.xml',
      type: 'xml',
      element: 'item',
  } %}
  
  {% set feed = craft.feedme.feed(params) %}
  
  {% for node in feed %}
    {{ node.category.attributes.domain }}
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Hmm, I see that the feedforall xml file is displayed in Chrome as an xml file. With expandable nodes. However in my own rss feed it's not rendered that way. Maybe that might be the issue. I updated my original post with a screenshot of my feed as opened in Chrome.  
  > **username_1**: Yeah, I saw the same too - now that makes sense. Thats just likely the way its outputted. It _may_ have something to do with it - it also could be that there is no inner-value for the `enclosure` node, so it ignores it. I'll have a test.  
  > **username_0**: You were right, it was that some of the enclosure nodes was empty. I added a filter `{{ node.enclosure.attributes.url|default('empty') }}`. And it's working now :)  
  > **username_1**: Awesome - I'll try to work this into the plugin - normally it would skip over nodes without an inner value, but it'll also need a check in there for attributes. Thanks!  
  
  ---
  
  