Introduction to the syndication extension architecture

Common publishing formats such as Really Simple Syndication (RSS) and the Atom Syndication Format allow for the addition of information and meta-data that is outside the scope of the format specification through the use of syndication extensions. The framework provides an extensibility model for syndication resources (objects that implement the ISyndicationResource interface) that allows you to consume and include syndication extension information.

A syndication format such as RSS or Atom is extended through the use of XML namespaces. Each extension to a syndication format involves a unique XML namespace that qualifies the elements and attributes being added to the syndication format. The framework will by default automatically retrieve the extensions that have been applied to the syndication format entities based on the declared XML namespaces. While the framework natively supports the most common syndication extensions in use today, you may create your own custom syndication extensions using the syndication resource extensibility model.

The extensibility model of the framework is architected using interface inheritance by providing the ISyndicationExtension and IExtensibleSyndicationObject interfaces. The extensibility model also supports change notification through the use of events. The extensions applied to a syndication entity are exposed as an IEnumerable collection of ISyndicationExtension objects, which allows you to write queries against the extensions collections by using language keywords and familiar operators using Language-Integrated Query (LINQ); while still providing a common API to program against regardless of whether you are using the .NET 2.0 or .NET 3.5 versions of the framework.

The ISyndicationExtension interface and the related SyndicationExtension abstract base class provide a means of describing the information that is used to extend a syndication format. When creating your own custom syndication extensions, you either implement the ISyndicationExtension interface or inherit from the SyndicationExtension base class. Implementers of custom syndication extensions may also optionally utilize the SyndicationExtensionAdapter class to easily retrieve syndication extension information from the underlying XML data source.

The IExtensibleSyndicationObject interface provides a means of adding, retrieving, or removing syndication extensions for syndication entities. The IExtensibleSyndicationObject interface defines the minimal properties and methods that provide a common way to manipulate extension information. All syndication entities in the framework that can participate in the extensibility model implement the IExtensibleSyndicationObject interface.

Core extensibility model entities

ISyndicationExtension Interface
  • Overview
    • Allows an object to implement a syndication extension by representing a set of properties, methods, indexers and events common to web content syndication extensions.
  • Properties
    • Description: Gets a human-readable description of the syndication extension.
    • Documentation: Gets an Uri that points to documentation for the syndication extension.
    • Name: Gets the human-readable name of the syndication extension.
    • Version: Gets the Version of the specification that the syndication extension conforms to.
    • XmlNamespace: Gets the XML namespace that is used when qualifying the syndication extension's element and attribute names.
    • XmlPrefix: Gets the prefix used to associate the syndication extension's element and attribute names with the syndication extension's XML namespace.
  • Events
    • Loaded: Occurs when the syndication extension state has been changed by a load operation.
  • Methods
    • CreateNamespaceManager(XPathNavigator): Initializes an XmlNamespaceManager object for resolving prefixed XML namespaces utilized by the SyndicationExtension.
    • ExistsInSource(XPathNavigator): Determines if the ISyndicationExtension exists in the XML data in the supplied XPathNavigator.
    • Load(IXPathNavigable): Initializes the syndication extension using the supplied IXPathNavigable.
    • Load(XmlReader): Initializes the syndication extension using the supplied XmlReader.
    • WriteTo(XmlWriter): Writes the syndication extension to the specified XmlWriter.
    • WriteXmlNamespaceDeclaration(XmlWriter): Writes the prefixed XML namespace for the current syndication extension to the specified XmlWriter.

SyndicationExtensionLoadedEventArgs Class
  • Overview
    • Provides data for the ISyndicationExtension.Loaded event.
  • Properties
    • Data: Gets a read-only XPathNavigator object for navigating the XML data that was used to load the syndication extension.
    • Extension: Gets the ISyndicationExtension that resulted from the load operation.

SyndicationExtension Class
  • Overview
    • Provides the set of methods, properties and events that web content syndication extensions should inherit from.
    • The SyndicationExtension abstract class is provided to reduce the difficulty of implementing custom syndication extensions. While implementers are free to implement their custom syndication extensions by implementing the ISyndicationExtension interface, it is recommended that custom syndication extensions inherit from the SyndicationExtension base class.

IExtensibleSyndicationObject Interface
  • Overview
    • Defines generalized extension properties, methods, indexers and events that a value type or class implements to create a type-specific implementation of extension properties, methods, indexers and events.
  • Properties
    • Extensions: Gets or sets the syndication extensions applied to the syndication entity.
    • HasExtensions: Gets a value indicating if the syndication entity has one or more syndication extensions applied to it.
  • Methods
    • AddExtension(ISyndicationExtension): Adds the supplied ISyndicationExtension to the current instance's Extensions collection.
    • FindExtension(Predicate<ISyndicationExtension>): Searches for a syndication extension that matches the conditions defined by the specified predicate, and returns the first occurrence within the Extensions collection.
    • RemoveExtension(ISyndicationExtension): Removes the supplied ISyndicationExtension from the current instance's Extensions collection.

SyndicationExtensionAdapter Class
  • Overview
    • Represents an XPathNavigator and SyndicationResourceLoadSettings that are used to fill an IExtensibleSyndicationObject.
  • Properties
    • Navigator: Gets the XPathNavigator used to fill an extensible syndication resource.
    • Settings: Gets the SyndicationResourceLoadSettings used to configure the fill of an extensible syndication resource.
  • Methods
    • Fill(IExtensibleSyndicationObject): Modifies the IExtensibleSyndicationObject to match the data source.
    • Fill(IExtensibleSyndicationObject, XmlNamespaceManager): Modifies the IExtensibleSyndicationObject to match the data source.

SyndicationResourceLoadSettings Class
  • Overview
    • Specifies a set of features to support on a ISyndicationResource object loaded by the ISyndicationResource.Load(IXPathNavigable, SyndicationResourceLoadSettings) method.
  • Properties
    • AutoDetectExtensions - Indicates if syndication extensions supported by the load operation are automatically determined based on the XML namespaces declared on the syndication resource.
    • CharacterEncoding - Indicates the character encoding to use when parsing a syndication resource.
    • RetrievalLimit - Determines the maximum number of resource entities to retrieve from a syndication resource.
    • SupportedExtensions - Indicates the custom syndication extensions that you wish to support.
    • Timeout - Specifies the amount of time after which asynchronous load operations will time out.

Last edited Mar 3, 2008 at 10:34 PM by Oppositional, version 3

Comments

No comments yet.