Coder Social home page Coder Social logo

jesperlind / wxf-api-wordpress-extended-format Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 164 KB

Provides an API for editing files in Wordpress eXtended Format (WxF) which is based on RSS 2.0. It can of course also create and edit regular RSS 2.0 feeds.

wxf-api-wordpress-extended-format's Introduction

Provides an API for editing files in Wordpress eXtended Format (WxF) which is based on RSS 2.0. It can of course also create and edit regular RSS 2.0 feeds.

using Wxf;

namespace ConsoleApplication1
{
     public class Program
     {
           WxfFeed feed = WxfReader.Parse("backup.xml");
           
           //Gets the RSS channel
           WxfChannel channel = feed.Channels[0];
           
           //Writes the title of the posts
           foreach(var i in channel.Items)
           {
                Console.WriteLine(i.Title);
           }
     }
}

You can use LINQ to easily query your data.


var result = from i in channel.Items
                  where i.Comments.Count > 0
                  select i;


Parse RSS 2.0 feeds


RssFeed feed = RssReader.Parse("feed.rss");

foreach(var i in feed.Channel[0].Items)
{
     Console.WriteLine(i.Title);
     Console.WriteLine(i.Description);
}


A WpRssFeed with cast to its base class, RssFeed.


var rss = feed.AsRssFeed();


Generating an RSS feed:


            RssFeed feed = new RssFeed()
            {
                Version = "2.0"
            };

            var channel = new RssChannel() 
            { 
                Title = "Rss Test Feed",
                Generator = "WxFLib",
                WebMaster = "Robertuzzu",
                Description = "Created by Robert Sundström",
                Link = new Uri("http://robertsundstrom.wordpress.com"),
                Language = "en",
                PublishingDate = DateTime.Now,
                LastBuildDate = DateTime.Now,
                ManagingEditor = "C#"
            };
            feed.Channels.Add(channel);

            for (int i = 0; i < 10; i++)
            {
                var item = new RssItem()
                {
                    Title = string.Format("Item {0}", i),
                    Description = "",
                    Link = new Uri("http://web/hello/"),
                    PublishingDate = DateTime.Now
                };
                channel.Items.Add(item);
            }

            feed.SaveXml("rss.xml");

Last edited Jun 25 2009 at 8:50 PM by Robertuzzu, version 12

wxf-api-wordpress-extended-format's People

Stargazers

Jesper Lind avatar

Watchers

Jesper Lind avatar James Cloos avatar

wxf-api-wordpress-extended-format's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.