I have the following error when I execute the application at this line SyndicationFeed feed = SyndicationFeed.Load(reader);
:
'Element' is an invalid XmlNodeType - Line 2799, position 4
This is my code :
namespace y
{
public class Database
{
public void GetDatas(String url)
{
XmlReader reader = XmlReader.Create("C:\\Users\\Lolo\\Desktop\\fluxRSS.xml");
SyndicationFeed feed = SyndicationFeed.Load(reader);
foreach (SyndicationItem item in feed.Items) {
String t = item.Title.Text;
String o = item.Summary.Text;
String p = item.Content.Type;
}
}
}
}
The fluxRSS.xml is structured like this :
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Recettes</title>
<link>http://www.lebruitdufrigo.fr/recettes.php?action=toutes_les_recettes</link>
<image>
<title>Recettes</title>
<link>http://www.lebruitdufrigo.fr/recettes.php?action=toutes_les_recettes</link>
<url>http://www.lebruitdufrigo.fr/medias/clipart/recette_big.png</url>
</image>
<description>les dernières recettes déposées</description>
<item>
<title>salade marocaine</title>
<link>http://www.lebruitdufrigo.fr/recette.php?id=275</link>
<description>la dernière recette de Ben</description>
<pubDate>Sat, 03 Nov 2012 21:00:42 +0100</pubDate>
</item>
//other items
</channel>
<channel>
//other items
</channel>
</rss>
I notice that if I remove all the content of the second and last channel tag, I always have the same error but if I delete completely the second channel tag, I don't have any errors anymore.
Do you have a solution to resolve this problem?