Reading non standard tags in a RSS feed

374 Views Asked by At

I'm trying to write an RSS feed for the Ferrari site, but I can't read it all, using SyndicationItem. The problem is that the method getContent() reads only <link>,<title> and <description> elements (all of them are children of <item>). I need to read also the content of the <textnews> element, child of <item>. I must modify this query:

feed.LoadFromXml(feedXML);
// Query LINQ per effettuare il mapping
return feed.Items.ToList().Select(x =>
    new FeedItem
    {

        Title = x.Title.ExtractText(),
        Uri = x.GetUri(),
        Id = (x.ItemUri != null) ? x.ItemUri.ToString() : x.Title.ExtractText(),
        PubDate = x.PublishedDate.ToLocalTime().DateTime,
        Content = x.GetContent(),
        PlainTextContent = x.GetContent().ToPlainText(),
        Subtitle = string.Empty,
        ContentType = x.GetContentType(),
    }).ToList();

Can you help me?

1

There are 1 best solutions below

1
On

You'd need to parse the document as an XDocument, then parse each node. Eg:

var doc = XDocument.Load(aString);
var news = doc.Element("textnews").InnerText;