Code Input :
var rss = new XElement("rss", new XAttribute("version", "2.0"));
var channel = new XElement("channel",
new XElement("title", "Liftoff News"),
new XElement("link", "http://liftoff.msfc.nasa.gov/"),
new XElement("description", "Liftoff to Space Exploration.")
);
rss.Add(channel);
channel.Add(new XElement("item",
new XElement("title", "Star City"),
new XElement("link", "http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp"),
new XElement("description", @"
How do Americans get ready to work with Russians aboard the
International Space Station? They take a crash course in culture, language
and protocol at Russia's Star City.
"),
new XElement("pubDate", DateTime.UtcNow),
new XElement("guid", "http://liftoff.msfc.nasa.gov/2003/06/03.html#item573")
));
var text = rss.ToString();
Text Output:
<rss version="2.0">
<channel>
<title>Liftoff News</title>
<link>http://liftoff.msfc.nasa.gov/</link>
<description>Liftoff to Space Exploration.</description>
<item>
<title>Star City</title>
<link>http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp</link>
<description>
How do Americans get ready to work with Russians aboard the
International Space Station? They take a crash course in culture, language
and protocol at Russia's Star City.
</description>
<pubDate>2012-05-30T10:21:14.014Z</pubDate>
<guid>http://liftoff.msfc.nasa.gov/2003/06/03.html#item573</guid>
</item>
</channel>
</rss>