How to export an OPML file

Coordinator
Sep 18, 2007 at 2:15 PM
1. Create some structure (tree) of your feeds. Use your own category class implementing the IOpmlCategory interface.

class SampleOpmlCategory : IOpmlCategory
{
private string title = String.Empty;
private List<IOpmlCategory> categories = new List<IOpmlCategory>();
private List<Feed> feeds = new List<Feed>();

public string Title
{
get
{
return title;
}
set
{
title = value;
}
}

public List<IOpmlCategory> Categories
{
get
{
return categories;
}
set
{
categories = value;
}
}

public List<Feed> Feeds
{
get
{
return feeds;
}
set
{
feeds = value;
}
}
}


2. Add subcategories and feeds to this category.

Feed feed = new Feed();
feed.Title = "Feed Title";
feed.WebUri = new FeedUri("http://.....");
feed.XmlUri = new FeedUri("http://...../rss.xml");

SampleOpmlCategory category = new SampleOpmlCategory();
category.Title = "Root category";
category.Feeds.Add(feed);

3. optional Create OpmlExportSettings object to specify OPML settings.

4. Call on of the OpmlManager.Export() methods to save OPML file in the specified location.

OpmlManager.Export(category, "C:\\output.opml");
Oct 3, 2007 at 2:11 AM
What would be the best way to import/parse an Opml file? Implement a new Parser class for opml?

Thx,

--jb