2

Windows コマンド ラインから、RSS フィードに発行できるようにしたいと考えています。私はこのようなものを視覚化します:

rsspub @builds "Build completed without errors."

次に、誰かが私のコンピューターにアクセスする可能性があります。

http://xp64-Matt:9090/builds/rss.xml

そして、日時と単純なテキスト「エラーなしでビルドが完了しました」を含む新しいエントリが表示されます。

フィード自体を別のポートで実行したいので、IIS や Apache など、日常的に自分のコンピューターで実行する必要があるものと格闘する必要はありません。

このようなものは存在しますか?

4

1 に答える 1

3

IIS webroot に保存できる RSS XML ファイルを作成する単純な .Net 3.5 C# プログラムを次に示します。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;

namespace CommandLineRSS
{
    class Program
    {
        static void Main( string[] args )
        {
            var file = args[ 0 ];
            var newEntry = args[ 1 ];

            var xml = new XmlDocument();

            if ( File.Exists( file ) )
                xml.Load( file );
            else
                xml.LoadXml( @"<rss version='2.0'><channel /></rss>" );

            var xmlNewEntry = Create( (XmlElement)xml.SelectSingleNode( "/rss/channel" ), "item" );
            Create( xmlNewEntry, "title" ).InnerText = newEntry;
            Create( xmlNewEntry, "pubDate" ).InnerText = DateTime.Now.ToString("R");

            xml.Save( file );
        }

        private static XmlElement Create( XmlElement parent, string tag )
        {
            var a = parent.OwnerDocument.CreateElement( tag );
            parent.AppendChild( a );
            return a;
        }
    }
}

次に、次のように呼び出すことができます。

CommandLineRSS.exe c:\inetpub\wwwroot\builds.xml "Build completed with errors."
于 2009-02-12T17:52:10.663 に答える