How do I filter an rss feed?
- I'm using windows
- The RSS feed is on an internal network (so I can't use external websites).
- The RSS reader I'd like to use is Outlook (again because of the internal network).
- I'm open to hearing about .net solutions. 开发者_开发百科
I'm building an program in C#. Something like this:
string originalFeedUrl = args[ 0 ];
string regex = args[ 1 ];
XmlDocument doc = new XmlDocument();
doc.Load( originalFeedUrl );
XmlNodeList descriptions = doc.SelectNodes( @"//item/description" );
foreach( XmlNode description in descriptions ) {
if( !Regex.IsMatch( description.InnerText, regex ) )
description.ParentNode.ParentNode.RemoveChild(description.ParentNode );
}
Console.WriteLine(doc.OuterXml);
精彩评论