GetRss20Formatter Method (Boolean)
Collapse the table of content
Expand the table of content

SyndicationItem.GetRss20Formatter Method (Boolean)

 

Gets an Rss20FeedFormatter instance.

Namespace:   System.ServiceModel.Syndication
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public Rss20ItemFormatter GetRss20Formatter(
	bool serializeExtensionsAsAtom
)

Parameters

serializeExtensionsAsAtom
Type: System.Boolean

A value that specifies whether to serialize element and attribute extensions with an Atom 1.0 namespace.

RSS 2.0 allows elements and attributes that are not in its specification only if they are within a namespace. When the serializedExtensionsAsAtom parameter is true, the formatter automatically adds the "a10" namespace to all extensions; otherwise, the extensions are not serialized.

The following code shows how to write a syndication item in RSS 2.0 format to an XML file, serializing attribute and element extensions.

SyndicationItem item = new SyndicationItem("Item Title", "Item Content", new Uri("http://Item/Alternate/Link"), "itemID", DateTimeOffset.Now);
Rss20ItemFormatter rssFormatter = item.GetRss20Formatter(true);
XmlWriter writer = XmlWriter.Create("output.xml");
rssFormatter.WriteTo(writer);
writer.Close();

.NET Framework
Available since 3.5
Silverlight
Available since 2.0
Return to top
Show:
© 2016 Microsoft