Atom10FeedFormatter 类

定义

一个用于在 SyndicationFeed 实例与 Atom 1.0 格式之间来回序列化的类。A class that serializes a SyndicationFeed instance to and from Atom 1.0 format.

public ref class Atom10FeedFormatter : System::ServiceModel::Syndication::SyndicationFeedFormatter, System::Xml::Serialization::IXmlSerializable
public class Atom10FeedFormatter : System.ServiceModel.Syndication.SyndicationFeedFormatter, System.Xml.Serialization.IXmlSerializable
type Atom10FeedFormatter = class
    inherit SyndicationFeedFormatter
    interface IXmlSerializable
Public Class Atom10FeedFormatter
Inherits SyndicationFeedFormatter
Implements IXmlSerializable
继承
Atom10FeedFormatter
派生
实现

示例

下面的代码演示如何创建 SyndicationFeed 并将其序列化为 Atom 1.0。The following code shows how to create a SyndicationFeed and serialize it to Atom 1.0.

SyndicationFeed feed = new SyndicationFeed("Test Feed", "This is a test feed", new Uri("http://Contoso/testfeed"), "TestFeedID", DateTime.Now);
SyndicationItem item = new SyndicationItem("Test Item", "This is the content for Test Item", new Uri("http://localhost/ItemOne"), "TestItemID", DateTime.Now);

List<SyndicationItem> items = new List<SyndicationItem>();
items.Add(item);
feed.Items = items;

XmlWriter atomWriter = XmlWriter.Create("Atom.xml");
Atom10FeedFormatter atomFormatter = new Atom10FeedFormatter(feed);
atomFormatter.WriteTo(atomWriter);
atomWriter.Close();
Dim feed As SyndicationFeed = New SyndicationFeed("Test Feed", "This is a test feed", New Uri("http:'Contoso/testfeed"), "TestFeedID", DateTime.Now)
Dim item As SyndicationItem = New SyndicationItem("Test Item", "This is the content for Test Item", New Uri("http:'localhost/ItemOne"), "TestItemID", DateTime.Now)

Dim items As List(Of SyndicationItem) = New List(Of SyndicationItem)
items.Add(item)
feed.Items = items

Dim atomWriter As XmlWriter = XmlWriter.Create("Atom.xml")
Dim atomFormatter As Atom10FeedFormatter = New Atom10FeedFormatter(feed)
atomFormatter.WriteTo(atomWriter)
atomWriter.Close()

注解

使用此类可以序列化 SyndicationFeed 的实例,以及从表示 Atom 1.0 源的 XML 文档创建 SyndicationFeed 的实例。Use this class to serialize instances of SyndicationFeed and to create instances of SyndicationFeed from XML documents that represent Atom1.0 feeds. 如果想要序列化从 SyndicationFeed 派生的类,请使用 Atom10FeedFormatter<TSyndicationFeed> 格式化程序。If you have derived a class from SyndicationFeed and want to serialize it, use the Atom10FeedFormatter<TSyndicationFeed> formatter.

备注

Atom 1.0 规范允许在其任何日期构造中指定秒的小数部分。The Atom 1.0 specification allows for fractional seconds to be specified in any of its date constructs. 序列化和反序列化时,WCF 实现会忽略秒的小数部分。When serializing and deserializing, the WCF implementation ignores the fractional seconds.

构造函数

Atom10FeedFormatter()

创建 Atom10FeedFormatter 类的新实例。Creates a new instance of the Atom10FeedFormatter class.

Atom10FeedFormatter(SyndicationFeed)

使用指定的 Atom10FeedFormatter 实例创建 SyndicationFeed 类的新实例。Creates a new instance of the Atom10FeedFormatter class with the specified SyndicationFeed instance.

Atom10FeedFormatter(Type)

创建 Atom10FeedFormatter 类的新实例。Creates a new instance of the Atom10FeedFormatter class.

属性

DateTimeParser

SyndicationFeedFormatter 类用来将 XmlDateTimeData 字符串数据转换为 DateTimeOffset 的委托。Delegate that is used by the SyndicationFeedFormatter class for converting XmlDateTimeData string data to DateTimeOffset.

(继承自 SyndicationFeedFormatter)
Feed

获取与格式化程序关联的 SyndicationFeedGets the SyndicationFeed associated with the formatter.

(继承自 SyndicationFeedFormatter)
FeedType

派生自与 SyndicationFeed 实例关联的 Atom10FeedFormatter 的实例。The instance derived from SyndicationFeed that is associated with the Atom10FeedFormatter instance.

PreserveAttributeExtensions

获取或设置一个值,该值指定是否在序列化过程中保留属性扩展。Gets or sets a value that specifies whether to preserve attribute extensions during serialization.

PreserveElementExtensions

获取或设置一个值,该值指定是否在序列化过程中保留元素扩展。Gets or sets a value that specifies whether to preserve element extensions during serialization.

UriParser

SyndicationFeedFormatter 类用来基于字符串输入创建 Uri 实例的委托。Delegate that is used by the SyndicationFeedFormatter class for creating Uri instances from string input.

(继承自 SyndicationFeedFormatter)
Version

获取格式化程序使用的联合版本。Gets the syndication version used by the formatter.

方法

CanRead(XmlReader)

验证指定的 XmlReader 是否包含有效的 Atom 1.0 联合源。Verifies whether the specified XmlReader contains a valid Atom 1.0 syndication feed.

CreateFeedInstance()

创建一个新的 SyndicationFeedCreates a new SyndicationFeed.

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ReadFrom(XmlReader)

从指定的 XmlReader 实例读取 Atom 1.0 联合源。Reads an Atom 1.0 syndication feed from the specified XmlReader instance.

ReadItem(XmlReader, SyndicationFeed)

使用 XmlReader 实例从 SyndicationFeed 实例读取联合项。Reads a syndication item from XmlReader instance using the SyndicationFeed instance.

ReadItems(XmlReader, SyndicationFeed, Boolean)

从指定的 SyndicationItem 读入 XmlReader 实例的集合。Reads in a collection of SyndicationItem instances from the specified XmlReader.

SetFeed(SyndicationFeed)

SyndicationFeed 实例与 SyndicationFeedFormatter 相关联。Associates a SyndicationFeed instance with the SyndicationFeedFormatter.

(继承自 SyndicationFeedFormatter)
ToString()

获取 SyndicationFeedFormatter 实例的字符串表示形式。Gets a string representation of the SyndicationFeedFormatter instance.

(继承自 SyndicationFeedFormatter)
WriteItem(XmlWriter, SyndicationItem, Uri)

将指定的 SyndicationItem 实例写入指定的 XmlWriterWrites the specified SyndicationItem instance to the specified XmlWriter.

WriteItems(XmlWriter, IEnumerable<SyndicationItem>, Uri)

SyndicationItem 实例的集合写入指定的 XmlWriterWrites a collection of SyndicationItem instances to the specified XmlWriter.

WriteTo(XmlWriter)

将与 Atom10FeedFormatter 关联的 SyndicationFeed 写入指定的 XmlWriterWrites the SyndicationFeed associated with the Atom10FeedFormatter to the specified XmlWriter.

显式接口实现

IXmlSerializable.GetSchema()

实现 GetSchema() 方法。Implements the GetSchema() method.

IXmlSerializable.ReadXml(XmlReader)

实现 ReadXml(XmlReader) 方法。Implements the ReadXml(XmlReader) method.

IXmlSerializable.WriteXml(XmlWriter)

实现 WriteXml(XmlWriter) 方法。Implements the WriteXml(XmlWriter) method.

适用于