Well, I needed a
opml parser for the widget i'm currently building using the mooTools. Since I couldn't found one that was standalone, i decided to do one.
The code is simple to use. It can be done in to ways: Parse a existing file, or create a new structure and the save it.
Let's parse one

:
//Parse a existing file
Opml data = Opml.Parse(Server.MapPath("app_Data/Data.opml"));
Now that I've got the opml structure, let's add a new
outline:
// add new outline
OpmlOutline myOutline = new OpmlOutline();
myOutline.Text = "CreativeMinds Blog";
myOutline.Title = "CreativeMinds Blog";
myOutline.Description = "CreativeMinds - because we all have one...";
myOutline.HtmlUrl = new Uri("http://www.brunofigueiredo.com");
myOutline.XmlUrl = new Uri("http://www.brunofigueiredo.com/rss.aspx");
data.AddOutline(myOutline);
For navigate the outline, you can use the new functionality of the generics lists, the foreach:
// navigate the outlines
data.Outlines.ForEach(delegate(OpmlOutline outline)
{
Response.Write(outline.Text + "<br>");
});
In the end, you can save to a file:
// save to a new file
data.Save(Server.MapPath("app_Data/clone.opml"));
The download can be done
where.
