Click here to Skip to main content
15,916,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private ActionResult readRssFeeds()
        {
            
            DataSet ds = new DataSet();
            using (SqlConnection con = new SqlConnection(metaClass.connection))
            {
                SqlDataAdapter da = new SqlDataAdapter("get_all_data", con);
                da.Fill(ds);
            }
            foreach (DataRow item1 in ds.Tables[1].Rows)
            {
                
                string xmlData = item1["rss_content"].ToString();
               
                XmlReader reader = XmlReader.Create(new StringReader(xmlData));
                try
                {
                    SyndicationFeed feed = SyndicationFeed.Load(reader);
                    reader.Close();
                    foreach (SyndicationItem item in feed.Items)
                    {  
                        String subject = item.Title.Text;
                        String summary = item.Summary.Text;
                        string link = item.Links[0].BaseUri.ToString();

                    }

                }
                catch (Exception)
                {
                   
                    DataSet dss = new DataSet();
                    dss.ReadXml(new StringReader(xmlData));
                    continue;   
                }
                
                
            }
            return JavaScript("");
        }


the problem is..i can't read link from item in rss feed file.
Posted
Updated 21-Jan-14 9:28am
v2

1 solution

What have you tried ? If there's a link in the feed, I assume the feed is HTML. So, use regex to parse for anchor tags.
 
Share this answer
 
Comments
amr mustafa 21-Jan-14 16:14pm    
each item have link...i want to read this link...what is regex? can you give anything about it
Christian Graus 21-Jan-14 16:16pm    
https://www.google.com.au/search?q=C%23+regular+expressions&oq=C%23+regular+expressions&aqs=chrome..69i57j69i58j69i60l2j69i59l2.2539j0j8&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900