Revision as of 10:00, 16 June 2008 by Forum Nokia KB (Talk | contribs)

Archived:Example Syndication Service in WidSets

From Nokia Developer Wiki
Jump to: navigation, search

This script code uses the Syndication service to fetch the 10 most recent items from the www.digg.com RSS feed.


  void startWidget()
    setMinimizedView(createMinimizedView("viewMini", getStyle("default")));

  Shell openWidget()
    return null;

  void fetch()
    //As we do not have any content yet, we want all feed items
    //since the year 1970 (usually RSS feeds contain 20-30 items).
    Value arg = [
      "ts" => 0,
      "max" => 10

    call(null, "syndService", "getItems", arg, ok, nok);

  void ok(Object state, Value ret)
    setBubble(null, "Got "+ret.size()+" items");
    //print subjects to log
    foreach (Value item : ret) {
      printf("subject: "+item.title);

  void nok(Object state, String error)
    setBubble(null, "Syndication get failed: "+error);

} //class


<?xml version="1.0" encoding="utf-8"?>
<widget spec_version="2.0">
    <shortdescription>Syndication Service Example</shortdescription>
    <longdescription>Syndication Service Example</longdescription>
    <tags>example syndicationservice</tags>
    <parameter name="widgetname">Syndication Service</parameter>
    <parameter type="url" name="url" editable="false">

    <service type="syndication" id="syndService">
      <reference from="url" to="feedurl"/>
    <code src="syndication_service.he"/>
      mini {
        background: solid white;
        color: black;
        align: vcenter hcenter;
      maxi {
        background: solid white;
        padding: 5 5 5 5;
      flow {
        background: solid white;
  <layout minimizedheight="2em">
    <view id="viewMini" class="mini">
      <label class="mini">${widgetname}</label>
54 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.