Yoda
Yoda

Reputation: 18068

How to delete first line in the XML from the RSS feed

I would like to create RSS for my favourite website, but the problem is that it's RSS XML contains first line which corrupts whole RSS when parsing. How to delete the first line of the read data?

I get this error:

System does not support 'ISO-8859-2' encoding. Line 1, position 31.

Code:

void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) 
{
      SyndicationFeed feed;
      try {
           using (XmlReader reader = XmlReader.Create(e.Result)) { 
               // I WOULD LIKE to delete some rows from the Result
               feed = SyndicationFeed.Load(reader);
               lista.ItemsSource = feed.Items;
            }
       } catch (WebException we) { 
            MessageBox.Show("The internet connection is down.");
       }
}

Upvotes: 0

Views: 302

Answers (1)

Shai Aharoni
Shai Aharoni

Reputation: 1957

Try using: reader.MoveToContent() or reader.Skip() to skip irrelevant markup at the beginning of the file.

Upvotes: 1

Related Questions