Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Found a solution.</p> <p>I can add an item to the feed like this:</p> <pre><code>var contentItem = new SyndicationItem("title", "description", new Uri("http://myuri.com")); </code></pre> <p>and then add custom elements to this like this:</p> <pre><code>contentItem.ElementExtensions.Add("customElement", String.Empty, "text inside my custom element"); </code></pre> <p>If I want to add a custom element and add custom attributes to it; I can do:</p> <pre><code>contentItem.ElementExtensions.Add(new XElement("customImageElement", new XAttribute("type", "image/jpg"), new XAttribute("url", "www.myuri.com/pic1234.jpg")).CreateReader()); </code></pre> <p>This would output:</p> <pre><code>&lt;customImageElement type="image/jpg" url="www.myprovider.com/pic1234.jpg"&gt;&lt;/customImageElement&gt; </code></pre> <p>When I'm done, I add the contentItem to a <code>List&lt;SyndicationItem&gt;</code>, and add this list when I create the feed (items). </p> <p>I could also add custom elements to the feed itself, under the <code>&lt;channel&gt;</code> element:</p> <p>First add the feed with a list of items:</p> <pre><code>var feed = new SyndicationFeed("title text", "description text", new Uri("http://myuri.com"), items); </code></pre> <p>Then add the custom elements to the feed. under the element:</p> <pre><code>feed.ElementExtensions.Add(new XElement("image", new XElement("url", null, "http://www.myuri.com/logo.jpg"), new XElement("title", null, "MyImage"), new XElement("link", null, "http://myuri.com/contentid=1234"), new XElement("width", null, "100"), new XElement("height", null, "100"), new XElement("description", null, "This is my image")).CreateReader()); </code></pre> <p>This would output:</p> <pre><code>&lt;rss version="2.0"&gt; &lt;channel&gt; &lt;title&gt;title text&lt;/title&gt; &lt;link&gt;http://myuri.com&lt;/link&gt; &lt;description&gt;description text&lt;/description&gt; &lt;image&gt; &lt;url&gt;http://www.myprovider.com/logo.jpg&lt;/url&gt; &lt;title&gt;MyImage&lt;/title&gt; &lt;link&gt;http://myprovider.com/contentid=1234&lt;/link&gt; &lt;width&gt;100&lt;/width&gt; &lt;height&gt;100&lt;/height&gt; &lt;description&gt;This is my image&lt;/description&gt; &lt;/image&gt; &lt;item&gt; Items added to the items collection ... ... ... &lt;/item&gt; &lt;/channel&gt; &lt;/rss&gt; </code></pre> <p>That's what I could come up with. If there is a better way, please share. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload