Links

Non-RSS XML values

FeedOtter can also read additional, custom XML values in your RSS feed. Clients have used this to supply custom images and descriptions along with the standard RSS data fields.
This can be especially useful when building data-driven emails from job boards, news sites, and eCommerce applications.
A helpful starting point is to use the token [[ post.asArray | json_encode ]] in your loop. This will display the raw object that you can then use to access various elements using standard object / array notation as shown below.

Example 1

<item>
<title>Beautiful Painting of saharanpur</title>
<link>
https://uat.rauantiques.com/catalog/product/view/id/102845/
</link>
...
<custom_image>
<![CDATA[
https://cdn-uat.rauantiques.com/media/catalog/product/cache/1/image/265x/9df78eab33525d08d6e5fb8d27136e95/1/_/1_30-6635_1_3.png
]]>
</custom_image>
<price cost="$179,000" age="2,000 years" condition="perfect"></price>
...
Here is how to access the custom_image property in the FeedOtter post loop:
[% for post in feedotter.posts %] //standard post loop
//the post.asArray provides direct access to any xml fields in the <item> node of
the RSS feed
[[post.asArray.custom_image.value]]
[% endfor %]
You can also access attributes of custom elements such as the cost=”$179,000″. The post.asArray.price.attr contains all of the attributes on that node.
[% for post in feedotter.posts %] //standard post loop
//the post.asArray provides direct access to any xml fields in the <item> node of
the RSS feed
[[post.asArray.price.attr.cost]] // displays $179,000
[[post.AsArray.price.attr.age]] // 2,000 years
[[post.asArray.price.attr.condition]] // perfect
[% endfor %]

Example 2.

Here's another feed example with slightly different xml notation.
1
<item>
2
<title>Title Text</title>
3
<guid isPermaLink="false">https://link.com/article-link</guid>
4
<spadna:date>July 07, 2023</spadna:date>
5
<pubDate>Fri, 07 Jul 2023 07:50:31 PDT</pubDate>
6
<dna:title>Custom Title Text Here</dna:title>
7
<dna:pageNumber>196</dna:pageNumber>
8
<dna:textHeading>In Times of Illness, "Mental Health Issues"</dna:textHeading>
9
<description>... description text</description>
10
<dna:thought>... custom thought...</dna:thought>
11
</item>
Here the custom values are accessed slightly differently.
[[post.asArray.dna.textHeading]]
[[post.asArray.dna.thought]]
Last modified 7mo ago