Atom10FeedFormatter Classe

Definizione

Classe che serializza un'istanza SyndicationFeed da e verso il formato Atom 1.0.

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
Ereditarietà
Atom10FeedFormatter
Derivato
Implementazioni

Esempio

Il codice seguente illustra come creare un oggetto SyndicationFeed e serializzarlo in 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()

Commenti

Utilizzare questa classe per serializzare le istanze di SyndicationFeed e per creare istanze di SyndicationFeed da documenti XML che rappresentano feed Atom1.0. Se è stata derivata una classe da SyndicationFeed e si vuole serializzarla, usare il formattatore Atom10FeedFormatter<TSyndicationFeed> .

Note

La specifica Atom 1.0 consente di specificare secondi frazionari in uno dei costrutti di data. Durante la serializzazione e la deserializzazione, l'implementazione wcf ignora i secondi frazionari.

Costruttori

Nome Descrizione
Atom10FeedFormatter()

Crea una nuova istanza della Atom10FeedFormatter classe .

Atom10FeedFormatter(SyndicationFeed)

Crea una nuova istanza della Atom10FeedFormatter classe con l'istanza specificata SyndicationFeed .

Atom10FeedFormatter(Type)

Crea una nuova istanza della Atom10FeedFormatter classe .

Proprietà

Nome Descrizione
DateTimeParser

Delegato utilizzato dalla SyndicationFeedFormatter classe per convertire XmlDateTimeData i dati stringa in DateTimeOffset.

(Ereditato da SyndicationFeedFormatter)
Feed

Ottiene l'oggetto SyndicationFeed associato al formattatore.

(Ereditato da SyndicationFeedFormatter)
FeedType

Istanza derivata da SyndicationFeed associata all'istanza Atom10FeedFormatter di .

PreserveAttributeExtensions

Ottiene o imposta un valore che specifica se mantenere le estensioni degli attributi durante la serializzazione.

PreserveElementExtensions

Ottiene o imposta un valore che specifica se mantenere le estensioni degli elementi durante la serializzazione.

UriParser

Delegato usato dalla classe per la creazione di Uri istanze dall'input SyndicationFeedFormatter di stringa.

(Ereditato da SyndicationFeedFormatter)
Version

Ottiene la versione di diffusione utilizzata dal formattatore.

Metodi

Nome Descrizione
CanRead(XmlReader)

Verifica se l'oggetto specificato XmlReader contiene un feed di diffusione Atom 1.0 valido.

CreateFeedInstance()

Crea un nuovo SyndicationFeedoggetto .

Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
GetHashCode()

Funge da funzione hash predefinita.

(Ereditato da Object)
GetType()

Ottiene il Type dell'istanza corrente.

(Ereditato da Object)
MemberwiseClone()

Crea una copia superficiale del Objectcorrente.

(Ereditato da Object)
ReadFrom(XmlReader)

Legge un feed di diffusione Atom 1.0 dall'istanza specificata XmlReader .

ReadItem(XmlReader, SyndicationFeed)

Legge un elemento di diffusione dall'istanza XmlReader usando l'istanza SyndicationFeed di .

ReadItems(XmlReader, SyndicationFeed, Boolean)

Legge in una raccolta di SyndicationItem istanze dall'oggetto specificato XmlReader.

SetFeed(SyndicationFeed)

Associa un'istanza SyndicationFeed a SyndicationFeedFormatter.

(Ereditato da SyndicationFeedFormatter)
ToString()

Ottiene una rappresentazione di stringa dell'istanza SyndicationFeedFormatter .

(Ereditato da SyndicationFeedFormatter)
WriteItem(XmlWriter, SyndicationItem, Uri)

Scrive l'istanza specificata SyndicationItem nell'oggetto specificato XmlWriter.

WriteItems(XmlWriter, IEnumerable<SyndicationItem>, Uri)

Scrive una raccolta di SyndicationItem istanze nell'oggetto specificato XmlWriter.

WriteTo(XmlWriter)

Scrive l'oggetto SyndicationFeed associato all'oggetto Atom10FeedFormatter nell'oggetto specificato XmlWriter.

Implementazioni dell'interfaccia esplicita

Nome Descrizione
IXmlSerializable.GetSchema()

Implementa il GetSchema() metodo .

IXmlSerializable.ReadXml(XmlReader)

Implementa il ReadXml(XmlReader) metodo .

IXmlSerializable.WriteXml(XmlWriter)

Implementa il WriteXml(XmlWriter) metodo .

Si applica a