Quantcast
Channel: Error Loading RSS XML: Element 'channel' with namespace name '' was not found. - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Emperor XLII for Error Loading RSS XML: Element 'channel' with namespace name '' was not found.

$
0
0

Thanks to Michael’s answer, I was able to pre-process the offending XML (which is not under my control) to move errant atom:link elements:

private static readonly XName AtomLink = XName.Get( "link", "http://www.w3.org/2005/Atom" );private static readonly XName Channel = XName.Get( "channel" );...var document = XDocument.Load( stream );var channel = document.Root.Element( Channel );foreach( var misplacedLink in document.Root.Elements( AtomLink ) ) {    misplacedLink.Remove( );    channel.Add( misplacedLink );}using( var reader = document.CreateReader( ) )    return SyndicationFeed.Load( reader );

Viewing all articles
Browse latest Browse all 3

Trending Articles