HTML and CSS Reference
In-Depth Information
Important The lesson you should learn from this is that if at some point you code a feature
and it just doesn't work, without any apparent reason, check to make sure that you have
declared the appropriate capability for each Windows 8 API your feature requires. Note also
that in Microsoft Visual Studio 2012, the Internet Client capability—the minimum capability
required to make WinJS.xhr work—is the only capability turned on by default.
parsing and displaying downloaded data
At this point, you know everything you need to place a successful call to a remote HTTP endpoint and
grab some data. The next step is to do something significant with that data. In this exercise, you will
call into the Google News service to download the latest news as an RSS feed. Next, you will parse the
returned string into a list of items and use them to populate a list view.
extending the rSS reader application
Before you turn your attention to parsing RSS data, some changes to the user interface of the
application are in order. To make those changes, first open default.html and enter the following
<h1>RSS Reader (CH11)</h1>
<div id="newslist" data-win-control="WinJS.UI.ListView">
<div id="splitView">
<div id="titleDetail"></div>
<div id="pubDateDetail"></div>
<div id="categoryDetail"></div>
<div id="descriptionDetail"></div>
The DIV element named newslist is the ListView component that will contain all the downloaded
news. The DIV element named splitView is where you'll provide a preview of a selected news item.
Another important piece of markup to add is the HTML template for the news. Before you can
write this template, however, you must have a clear idea of what you're getting from the HTTP
endpoint and how you intend to transform that content into usable data.
parsing the rSS content
Open the rssReaderApp.js file, select the rssReaderApp.init function, and edit it as shown below:
WinJS.xhr({ url: rssReaderApp.Feed }).then(
function (response) {
Search WWH ::

Custom Search