Aracılığıyla paylaş


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 ref class SyndicationItem sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Syndication.ISyndicationItemFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class SyndicationItem final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Syndication.ISyndicationItemFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class SyndicationItem final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Syndication.ISyndicationItemFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class SyndicationItem
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Syndication.ISyndicationItemFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class SyndicationItem
function SyndicationItem(title, content, uri)
Public NotInheritable Class SyndicationItem
Inheritance
Object Platform::Object IInspectable SyndicationItem
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

The following code demonstrates how to access the property values of a SyndicationItem object.

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()

Creates a new SyndicationItem object.

SyndicationItem(String, SyndicationContent, Uri)

Creates a new SyndicationItem object with a title, content, and URI.

Properties

AttributeExtensions

Gets the list of custom attributes of the element.

Authors

Gets the authors of an item. This property represents the collection of all the atom:author elements under atom:entry.

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.

Categories

Gets a collection of categories of the feed. This property represents the collection of all the atom:category elements under atom:feed.

CommentsUri

Gets or sets the Uniform Resource Identifier (URI) of the comments for the item. This property represents the /rss/channel/item/comments element.

Content

Gets or sets the content of the item.

Contributors

Gets a collection of the contributors of the feed. This property represents the collection of all the atom:contributor elements under atom:feed.

EditMediaUri

Gets the Uniform Resource Identifier (URI) of an editable media resource.

EditUri

Gets the Uniform Resource Identifier (URI) of an editable resource.

ElementExtensions

Gets the list of child elements within the element.

ETag

Gets an ETag HTTP header.

Id

Gets or sets the identifier for the syndication feed.

ItemUri

Gets the Uniform Resource Identifier (URI) of this item. AtomPubClient creates this property after new resource is created.

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.

LastUpdatedTime

Gets or sets the most recent time the item was modified. This property represents the atom:updated element.

Links

Gets the links contained in the item.

NodeName

Gets or sets the local name of the element.

NodeNamespace

Gets or sets the namespace of the element.

NodeValue

Gets or sets the text content of the element. If the element contains only child elements, this property is NULL.

PublishedDate

Gets or sets the date the item was published.

Rights

Gets or sets information about the rights of an item. This property represents the atom:rights element.

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.

Summary

Gets or sets a summary of the item.

Title

Gets or sets the title of the item.

Methods

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.

Load(String)

Initializes the object from the given feed string, which can be in either RSS 2.0 or Atom 1.0 format.

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.

Applies to

See also