SyndicationItem
SyndicationItem
SyndicationItem
SyndicationItem
Class
Definition
Represents an item in the feed. This class encapsulates information in the /rss/channel/item element in RSS 2.0 or the atom:entry element in Atom 1.0.
public : sealed class SyndicationItem : ISyndicationItem, ISyndicationNodepublic sealed class SyndicationItem : ISyndicationItem, ISyndicationNodePublic NotInheritable Class SyndicationItem Implements ISyndicationItem, ISyndicationNode// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Remarks
The following code demonstrates how to access the property values of a SyndicationItem object.
function displayCurrentItem() {
var item = currentFeed.items[currentItemIndex];
// Title.
var title = item.title || "(no title)";
document.getElementById("feedItemTitle").innerText = title;
// Display the main link.
var link = "";
if (item.links.size > 0) {
link = item.links[0].uri.absoluteUri;
}
var feedLink = document.getElementById("feedLink");
feedLink.innerText = link;
feedLink.href = link;
// Display the body as HTML.
var content = item.content || item.summary || "(no content)";
document.getElementById("feedWebView").innerHTML = content;
}
using Windows.Foundation;
using Windows.Web.Syndication;
private void DisplayCurrentItem()
{
SyndicationItem item = currentFeed.Items[currentItemIndex];
// Title
FeedItemTitle.Text = item.Title != null ? item.Title.Text : "(no title)";
// Display the main link
string link = string.Empty;
if (item.Links.Count > 0)
{
link = item.Links[0].Uri.AbsoluteUri;
}
FeedLink.Content = link;
// Display the body as HTML
string content = "(no content)";
if (item.Content != null)
{
content = item.Content.Text;
}
else if (item.Summary != null)
{
content = item.Summary.Text;
}
FeedWebView.NavigateToString(content);
}
For additional examples that demonstrate how this class is used to represent feed content, see Quickstart: Accessing a web feed.
The following table maps SyndicationItem properties to RSS and Atom feed elements.
| SyndicationItem | RSS Channel/Item | Atom entry | AtomPub |
|---|---|---|---|
| AttributeExtensions (foreign markup) | |||
| Authors | author | authors | |
| BaseUri | |||
| Categories | category | category | |
| CommentsUri | comments | ||
| Content | content | ||
| Contributors | contributor | ||
| EditMediaUri | link with rel="edit-media" | ||
| EditUri | link with rel="edit" | ||
| ElementExtensions (foreign markup) | |||
| Etag | ETag header after CreateResourceAsync | ||
| Id | guid | id | Location header after CreateResourceAsync |
| ItemUri | |||
| Language | xml:lang | xml:lang | |
| LastUpdatedTime | updated | ||
| Links | link/enclosure | link | |
| NodeName | |||
| NodeNamespace | |||
| NodeValue | |||
| PublishedDate | pubDate | published | |
| Rights | rights | ||
| Source | source | source | |
| Summary | description | summary | |
| Title | title | title |
Constructors
SyndicationItem() SyndicationItem() SyndicationItem() SyndicationItem()
Creates a new SyndicationItem object.
public : SyndicationItem()public SyndicationItem()Public Sub New()// You can use this method in JavaScript.
SyndicationItem(String, SyndicationContent, Uri) SyndicationItem(String, SyndicationContent, Uri) SyndicationItem(String, SyndicationContent, Uri) SyndicationItem(String, SyndicationContent, Uri)
Creates a new SyndicationItem object with a title, content, and URI.
public : SyndicationItem(PlatForm::String title, SyndicationContent content, Uri uri)public SyndicationItem(String title, SyndicationContent content, Uri uri)Public Sub New(title As String, content As SyndicationContent, uri As Uri)// You can use this method in JavaScript.
- title
- PlatForm::String String String String
Title of the new item.
The content for this feed item.
- uri
- Uri Uri Uri Uri
The URI associated with this item.
Properties
AttributeExtensions AttributeExtensions AttributeExtensions AttributeExtensions
Gets the list of custom attributes of the element.
public : IVector<SyndicationAttribute> AttributeExtensions { get; }public IList<SyndicationAttribute> AttributeExtensions { get; }Public ReadOnly Property AttributeExtensions As IList<SyndicationAttribute>// You can use this property in JavaScript.
- Value
- IVector<SyndicationAttribute> IList<SyndicationAttribute> IList<SyndicationAttribute> IList<SyndicationAttribute>
A list of attributes of the element.
Authors Authors Authors Authors
Gets the authors of an item. This property represents the collection of all the atom:author elements under atom:entry.
public : IVector<SyndicationPerson> Authors { get; }public IList<SyndicationPerson> Authors { get; }Public ReadOnly Property Authors As IList<SyndicationPerson>// You can use this property in JavaScript.
- Value
- IVector<SyndicationPerson> IList<SyndicationPerson> IList<SyndicationPerson> IList<SyndicationPerson>
The collection of all the atom:author elements under atom:entry.
BaseUri BaseUri BaseUri BaseUri
Gets or sets the base URI for the element. This property represents the xml:base attribute on the element. It may be inherited from an ancestor element.
public : Uri BaseUri { get; set; }public Uri BaseUri { get; set; }Public ReadWrite Property BaseUri As Uri// You can use this property in JavaScript.
- Value
- Uri Uri Uri Uri
The xml:base attribute on the element.
Categories Categories Categories Categories
Gets a collection of categories of the feed. This property represents the collection of all the atom:category elements under atom:feed.
public : IVector<SyndicationCategory> Categories { get; }public IList<SyndicationCategory> Categories { get; }Public ReadOnly Property Categories As IList<SyndicationCategory>// You can use this property in JavaScript.
- Value
- IVector<SyndicationCategory> IList<SyndicationCategory> IList<SyndicationCategory> IList<SyndicationCategory>
The collection of all atom:category elements under atom:feed.
CommentsUri CommentsUri CommentsUri CommentsUri
Gets or sets the Uniform Resource Identifier (URI) of the comments for the item. This property represents the /rss/channel/item/comments element.
public : Uri CommentsUri { get; set; }public Uri CommentsUri { get; set; }Public ReadWrite Property CommentsUri As Uri// You can use this property in JavaScript.
- Value
- Uri Uri Uri Uri
The /rss/channel/item/comments element.
Content Content Content Content
Gets or sets the content of the item.
public : SyndicationContent Content { get; set; }public SyndicationContent Content { get; set; }Public ReadWrite Property Content As SyndicationContent// You can use this property in JavaScript.
The content of the item.
Contributors Contributors Contributors Contributors
Gets a collection of the contributors of the feed. This property represents the collection of all the atom:contributor elements under atom:feed.
public : IVector<SyndicationPerson> Contributors { get; }public IList<SyndicationPerson> Contributors { get; }Public ReadOnly Property Contributors As IList<SyndicationPerson>// You can use this property in JavaScript.
- Value
- IVector<SyndicationPerson> IList<SyndicationPerson> IList<SyndicationPerson> IList<SyndicationPerson>
The collection of all atom:contributor elements under atom:feed.
EditMediaUri EditMediaUri EditMediaUri EditMediaUri
Gets the Uniform Resource Identifier (URI) of an editable media resource.
public : Uri EditMediaUri { get; }public Uri EditMediaUri { get; }Public ReadOnly Property EditMediaUri As Uri// You can use this property in JavaScript.
- Value
- Uri Uri Uri Uri
The atom:link element with the attribute rel=”edit-media”.
Remarks
This property represents the atom:link element with the attribute rel=”edit-media”. It is the absolute Uniform Resource Identifier (URI) resolved against the xml:base attribute, if it is present. If the href attribute is a relative Uniform Resource Identifier (URI) string and there is no xml:base attribute, this property will be null since the relative Uniform Resource Identifier (URI) is not supported by the runtime Uniform Resource Identifier (URI) class.
EditUri EditUri EditUri EditUri
Gets the Uniform Resource Identifier (URI) of an editable resource.
public : Uri EditUri { get; }public Uri EditUri { get; }Public ReadOnly Property EditUri As Uri// You can use this property in JavaScript.
- Value
- Uri Uri Uri Uri
The atom:link element with rel="edit".
Remarks
This property represents the atom:link element with the attribute rel=”edit”. It is the absolute Uniform Resource Identifier (URI) resolved against the xml:base attribute, if it is present. If the href attribute is a relative Uniform Resource Identifier (URI) string and there is no xml:base attribute, this property will be null since the relative Uniform Resource Identifier (URI) is not supported by the runtime Uniform Resource Identifier (URI) class.
ElementExtensions ElementExtensions ElementExtensions ElementExtensions
Gets the list of child elements within the element.
public : IVector<ISyndicationNode> ElementExtensions { get; }public IList<ISyndicationNode> ElementExtensions { get; }Public ReadOnly Property ElementExtensions As IList<ISyndicationNode>// You can use this property in JavaScript.
- Value
- IVector<ISyndicationNode> IList<ISyndicationNode> IList<ISyndicationNode> IList<ISyndicationNode>
The list of child elements within the element.
Remarks
The following elements in the RSS 2.0 documents do not have public accessors;they can be accessed by searching the ElementExtensions collection on the SyndicationFeed object:
- /rss/channel/docs
- /rss/channel/cloud
- /rss/channel/pubDate
- /rss/channel/webmaster
- /rss/channel/ttl
- /rss/channel/rating
- /rss/channel/textInput
- /rss/channel/skipDays
- /rss/channel/skipHours
ETag ETag ETag ETag
Gets an ETag HTTP header.
public : PlatForm::String ETag { get; }public string ETag { get; }Public ReadOnly Property ETag As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
An Etag HTTP header.
Remarks
When an AtomPub endpoint returns a syndication entry, it may include an ETag HTTP header, which will be tied to the SyndicationItem object and show up in this property. AtomPubClient will also use ETag when updating or deleting a resource for synchronization control.
Id Id Id Id
Gets or sets the identifier for the syndication feed.
public : PlatForm::String Id { get; set; }public string Id { get; set; }Public ReadWrite Property Id As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The atom:Id element or the guid element in RSS 2.0.
ItemUri ItemUri ItemUri ItemUri
Gets the Uniform Resource Identifier (URI) of this item. AtomPubClient creates this property after new resource is created.
public : Uri ItemUri { get; }public Uri ItemUri { get; }Public ReadOnly Property ItemUri As Uri// You can use this property in JavaScript.
- Value
- Uri Uri Uri Uri
The Uniform Resource Identifier (URI) of the item.
Language Language Language Language
Gets or sets the language of the element. This property represents the xml:lang attribute on the element. It may be inherited from an ancestor element. It must be valid according to XML 1.0.
public : PlatForm::String Language { get; set; }public string Language { get; set; }Public ReadWrite Property Language As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The xml:lang attribute on the element.
LastUpdatedTime LastUpdatedTime LastUpdatedTime LastUpdatedTime
Gets or sets the most recent time the item was modified. This property represents the atom:updated element.
public : DateTime LastUpdatedTime { get; set; }public DateTimeOffset LastUpdatedTime { get; set; }Public ReadWrite Property LastUpdatedTime As DateTimeOffset// You can use this property in JavaScript.
- Value
- DateTime DateTimeOffset DateTimeOffset DateTimeOffset
The atom:updated element.
Links Links Links Links
Gets the links contained in the item.
public : IVector<SyndicationLink> Links { get; }public IList<SyndicationLink> Links { get; }Public ReadOnly Property Links As IList<SyndicationLink>// You can use this property in JavaScript.
- Value
- IVector<SyndicationLink> IList<SyndicationLink> IList<SyndicationLink> IList<SyndicationLink>
The collection of all the atom:link elements under atom:entry.
Remarks
This property represents the collection of all the atom:link elements under atom:entry. For RSS 2.0, this collection includes link, enclosure, and comments elements.
NodeName NodeName NodeName NodeName
Gets or sets the local name of the element.
public : PlatForm::String NodeName { get; set; }public string NodeName { get; set; }Public ReadWrite Property NodeName As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The local name of the element. Must be valid according to XML 1.0.
NodeNamespace NodeNamespace NodeNamespace NodeNamespace
Gets or sets the namespace of the element.
public : PlatForm::String NodeNamespace { get; set; }public string NodeNamespace { get; set; }Public ReadWrite Property NodeNamespace As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The namespace of the element.
NodeValue NodeValue NodeValue NodeValue
Gets or sets the text content of the element. If the element contains only child elements, this property is NULL.
public : PlatForm::String NodeValue { get; set; }public string NodeValue { get; set; }Public ReadWrite Property NodeValue As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The text content of the element.
PublishedDate PublishedDate PublishedDate PublishedDate
Gets or sets the date the item was published.
public : DateTime PublishedDate { get; set; }public DateTimeOffset PublishedDate { get; set; }Public ReadWrite Property PublishedDate As DateTimeOffset// You can use this property in JavaScript.
- Value
- DateTime DateTimeOffset DateTimeOffset DateTimeOffset
The atom:published element under atom:entry or the pubDate element under item element in RSS 2.0.
Rights Rights Rights Rights
Gets or sets information about the rights of an item. This property represents the atom:rights element.
public : ISyndicationText Rights { get; set; }public ISyndicationText Rights { get; set; }Public ReadWrite Property Rights As ISyndicationText// You can use this property in JavaScript.
The atom:rights element.
Source Source Source Source
Gets or sets the source feed of the item. This property represents the atom:source element or the source element in RSS 2.0.
public : SyndicationFeed Source { get; set; }public SyndicationFeed Source { get; set; }Public ReadWrite Property Source As SyndicationFeed// You can use this property in JavaScript.
The atom:source element or the source element in RSS 2.0.
Summary Summary Summary Summary
Gets or sets a summary of the item.
public : ISyndicationText Summary { get; set; }public ISyndicationText Summary { get; set; }Public ReadWrite Property Summary As ISyndicationText// You can use this property in JavaScript.
The atom:summary element or the description element in RSS 2.0.
Methods
GetXmlDocument(SyndicationFormat) GetXmlDocument(SyndicationFormat) GetXmlDocument(SyndicationFormat) GetXmlDocument(SyndicationFormat)
Generates the DOM object that represents this element, all the attributes and child elements including foreign markups. The only formats accepted by this method are Atom 1.0 and RSS 2.0.
public : XmlDocument GetXmlDocument(SyndicationFormat format)public XmlDocument GetXmlDocument(SyndicationFormat format)Public Function GetXmlDocument(format As SyndicationFormat) As XmlDocument// You can use this method in JavaScript.
The format of the data.
The DOM object that represents this element, and all the attributes and child elements, including foreign markups.
Load(String) Load(String) Load(String) Load(String)
Initializes the object from the given feed string, which can be in either RSS 2.0 or Atom 1.0 format.
public : void Load(PlatForm::String item)public void Load(String item)Public Function Load(item As String) As void// You can use this method in JavaScript.
- item
- PlatForm::String String String String
The feed string, which can be in either RSS 2.0 or Atom 1.0 format.
LoadFromXml(XmlDocument) LoadFromXml(XmlDocument) LoadFromXml(XmlDocument) LoadFromXml(XmlDocument)
Initializes the object from the given DOM object, which can contain XML content in either RSS 2.0 or Atom 1.0 format.
public : void LoadFromXml(XmlDocument itemDocument)public void LoadFromXml(XmlDocument itemDocument)Public Function LoadFromXml(itemDocument As XmlDocument) As void// You can use this method in JavaScript.
- itemDocument
- XmlDocument XmlDocument XmlDocument XmlDocument
The DOM object, which can contain XML content in either RSS 2.0 or Atom 1.0 format.