Filed under app , C# , wp7 , xml
I've just submitted a new update to the Windows Marketplace for my RTE News Reader app. This update is only a minor update but includes a fix to a nasty bug that was forcing some news articles to not display.
The bug was caused by badly formatted XML from RTE.ie - rogue ampersands to be precise. I was able to track down that it was badly formatted XML by using a simple XML validate checker - http://validator.w3.org/feed/ This checker highlights everywhere that the feed could be failing.
Once I could see the issues I then had to put in a workaround. The problem with just replacing &'s is that they are also going to be used for valid html encoded values in the XML. I had to ensure that I was replacing single ampersands only. I was able to do this by using a regular expression to find single instances of ampersands in the text and replaced them with html encoded versions of themselves. This Stackoverflow article discusses how to implement such a fix: http://stackoverflow.com/questions/121511/reading-xml-with-an-into-c-sharp-xmldocument-object
The app is now going through the usual approval processes in the App Hub. All going well, it should be available for download by the end of next week.