HTML and CSS Reference
document.getElementById("titleDetail").innerHTML = currentArticle.title;
document.getElementById("pubDateDetail").innerHTML = currentArticle.pubDate;
document.getElementById("categoryDetail").innerHTML = currentArticle.category;
document.getElementById("descriptionDetail").innerHTML = amended;
You first get the index of the selected item and retrieve the news it refers to. At this point you set
the innerHTML property of the HTML element that is expected to contain the description of the news,
as well as some other context information such as publication date and category. When you provide
the news item preview you set the elements of the splitView DIV you created earlier in the exercise.
The description of the news you get from the Google News feed usually contains IMG tags. For
some reason the URL to these images is missing the http:// prefix, which causes Windows 8 to be
unable to render the image. A simple string replace operation does the trick, as you can see in the
preceding code. Figure 11-6 shows the final result.
FIGURE 11-6 The final version of the RSS Reader application, with a preview for a selected news item.
Working with JSON data
Another common scenario for Windows Store applications involves downloading data from services
content available in a variety of formats, the most common of which are XML (and RSS in particular)
and JSON. You already worked with the WinJS API for JSON in a previous chapter. In Chapter 10,
”Adding persistent data to applications,” you saved application data to JSON and read it back later.
In that example, you were entirely responsible for the full data cycle—serialization, persistence, and