0

I’m building a Windows 8 app in C# to show RSS feeds into the App http://blogs.msdn.com/b/jasonz/rss.aspx . This works fine when I’m reading the RSS feed and convert all content to text and bind all the feed items to the XAML properties. The next step was to convert the (x)HTML to XAML so the layout and markup would be translated and shown in a RichTextBlock.

To accomplish that I’m using this code ( https://github.com/MacawNL/WinRT-RichTextBlock.Html2Xaml ) to bind and convert html to xaml to a RichTextBlock. Which seems to work fine when I’m using a string var with some sample HTML in it. var content = “test and test number two”; Also the test and example strings work fine.

But as soon as I try to put my RSS feed content (with (x)HTML) into the WinRt-RichTechtBlock.Html2Xaml I get an exception error on this line: xhtmlDoc.LoadXml(xhtml); in RichTextBlockProperties.cs .

This is the Exception Error

An exception of type 'System.ArgumentException' occurred in mscorlib.dll but was not handled in user code Additional information: Value does not fall within the expected range.

I’ve been trying to find a way to parse / load my downloaded content from the RSS feed into the xhtmlDoc.LoadXml function but with no success.

How can i get WinRT-RichTextBlock.Html2Xaml to understand the content from the RSS feed to it can convert the HTML to the correct XAML tag?

Update

The xHTML could indeed be invalid (as you can see when you look at the RSSfeed) it's just some parts of HTML not the whole document). But I want to ignore those errors, and handle the correct ones it can find.

user1923728
  • 153
  • 1
  • 13

1 Answers1

0

The error was because of invalid HTML. As soon as I stripped the invalid parts (e.g. target=_blank vs target="_blank" ) the exception error disappeared.

user1923728
  • 153
  • 1
  • 13