Question

we know that all blog show his blog 's rss feed by

<link rel="alternate" type="application/rss+xml" title="MyBlog RSS Feed" href="http://feeds.feedburner.com/MyBlog" />

but are you know any regex to get feedurl from this

<link rel="alternate" type="application/rss+xml" title="MyBlog RSS Feed" href="http://feeds.feedburner.com/MyBlog" />
Was it helpful?

Solution

Use an XPath query like this one:

//link[@type='application/rss+xml']/@href

It'll pull out any RSS feed URL for you. Never parse XML or HTML with regular expressions, ever. XPath is specifically designed to query XML and HTML easy for you. It's available in nearly every technology stack, including .NET.

XML is not regular, and so regex is the incorrect tool to parse it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top