Ruby. I use standart builder to generate rss. My builder file is:
xml.instruct! :xml, :version => "1.0"
xml.rss(:version => "2.0") {
xml.channel {
xml.title(@digest.name)
xml.description(@digest.name)
xml.link(url_for(:only_path => false))
for post in @posts
xml.item do
xml.title(post.title || '')
xml.description(post.summary)
xml.link(post.url)
xml.source(post.feed.name)
xml.guid(post.url)
xml.pubDate(post.pub_date.to_s(:rfc822))
end
end
}
}
To generate an rss feed(require rss) I use next code :
xml.source(post.feed.name)
and get:
<source>Cnn news</source>
But I want something like that:
<source url="http://news.cnn.com">Cnn news</source>
How can I add parameter url to xml source tag?
I’m not sure what library you’re using to do this but if you pass a hash to builder it’ll just add that as attributes of the node.