×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    22

    Exclamation SDK 3rd Ed FP2 Emulator Error - Help!

    hey there,

    I have been developing an S60 widget which access to my created rss.xml feeds. It does work with my IE and Mozilla browsers, reading the feeds. It was fantastic!

    However, when I zipped it for debugging on my SDK 3rd edition FP 2 Device emulator, I encountered the following error:

    Error occured Thrown Error: Value xmlDoc.load(result of expression xmlDoc.load) is not object.

    Any help would be greatly appreciated.


    Appendix I - rss.js file

    function Replace(totalValue,oldValue,newValue)
    {
    while(totalValue.indexOf(oldValue) > -1)
    totalValue=totalValue.replace(oldValue,newValue);
    return totalValue;
    }

    /* Get XML Node
    (Parameters) TagName:'XML Element' node:'Element row number' */

    function getNode(TagName, node)
    {
    var currentNode = (node == null) ? xmlDoc.getElementsByTagName(TagName) :
    items[node].getElementsByTagName(TagName);
    if(currentNode.length > 0)
    return currentNode[0].firstChild.nodeValue;
    }

    /* Load XML Object
    (Parameters) rssFeed:'RSS File' Body:'Layer for RSS Body' Title:'Layer for RSS Title' */

    function ReadRSS(rssFeed, Body, Title)
    {
    rssTitle = document.getElementById(Title);
    rssBody = document.getElementById(Body);

    try
    {
    if (document.all)
    {
    var errorHappendHere = "Check Browser and security settings";
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    }
    else
    {
    var errorHappendHere = "Error!";
    xmlDoc = document.implementation.createDocument("","",null);
    }

    xmlDoc.async=false;
    xmlDoc.load(rssFeed);

    items=xmlDoc.getElementsByTagName('item');
    SetRSSTemplates();
    }

    catch(e)
    {
    rssTitle.innerHTML = 'Error occured';
    rssBody.innerHTML = 'Thrown Error:'+e.message+"<br/>Note: "+errorHappendHere;
    }
    }

    /* Set HTML Template
    enables layout to be easily customized, prevent confusion with the layout and codes. */

    function SetRSSTemplates()
    {
    if (rssBody)
    {
    var buffer = "";
    for(var i=0; i< items.length; i++)
    {
    var output = (document.all) ? Replace(rssBody.innerHTML,"(::Link::)",getNode('link',i))
    : Replace(rssBody.innerHTML,"%28::Link::%29",getNode('link',i));
    output = Replace(output,"(::Title::)",getNode('title',i));
    output = Replace(output,"(::Pubdate::)",getNode('pubDate',i));
    output = Replace(output,"(::Description::)",getNode('description',i));
    buffer+=output;
    }
    rssBody.innerHTML = buffer;
    }

    if (rssTitle)
    {
    var output = Replace(rssTitle.innerHTML,"(::Title::)",getNode('title'));
    output = (document.all) ? Replace(output,"(::Link::)",getNode('link'))
    : Replace(output,"%28::Link::%29",getNode('link'));
    output = Replace(output,"(::Description::)",getNode('description'));
    rssTitle.innerHTML = output;
    }
    }

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: SDK 3rd Ed FP2 Emulator Error - Help!

    Hi doubleuj,

    you're using ActiveX objects, that aren't supported at all in WRT environment:
    Code:
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    To create an XMLHttpRequest, you should use:
    Code:
    xmlDoc = new XMLHttpRequest();
    Check this page for futher infos about the XMLHttpRequest object:

    http://www.w3.org/TR/XMLHttpRequest/

    Pit

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    22

    Re: SDK 3rd Ed FP2 Emulator Error - Help!

    Quote Originally Posted by jappit View Post
    Hi doubleuj,

    you're using ActiveX objects, that aren't supported at all in WRT environment:
    Code:
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    To create an XMLHttpRequest, you should use:
    Code:
    xmlDoc = new XMLHttpRequest();
    Check this page for futher infos about the XMLHttpRequest object:

    http://www.w3.org/TR/XMLHttpRequest/

    Pit
    Hey pit,

    Is it possible you give me a snippet of how it does work? I tried the sources that you have provided, yes, it does work on my emulator. However, it only appears at undefined. Why?

    The following is the editted version:

    function Replace(totalValue,oldValue,newValue)
    {
    while(totalValue.indexOf(oldValue) > -1)
    totalValue=totalValue.replace(oldValue,newValue);
    return totalValue;
    }

    /* Get XML Node
    (Parameters) TagName:'XML Element' node:'Element row number' */

    function getNode(TagName, node)
    {
    var currentNode = (node == null) ? xmlDoc.getElementsByTagName(TagName) :
    items[node].getElementsByTagName(TagName);
    if(currentNode.length > 0)
    return currentNode[0].firstChild.nodeValue;
    }

    /* Load XML Object
    (Parameters) rssFeed:'RSS File' Body:'Layer for RSS Body' Title:'Layer for RSS Title' */

    function handler() {
    if(this.readyState == 4 && this.status == 200) {

    if(this.responseXML != null && this.responseXML.getElementById('item').firstChild.data)
    // success
    item(this.responseXML.getElementById('item').firstChild.data);
    else
    item(null);
    } else if (this.readyState == 4 && this.status != 200) {
    // fetched the wrong page or network error...
    item(null);
    }
    }

    function ReadRSS(rssFeed, Body, Title)
    {
    rssTitle = document.getElementById(Title);
    rssBody = document.getElementById(Body);

    try
    {
    if (document.all)
    {
    var errorHappendHere = "Check Browser and security settings";
    xmlDoc = new XMLHttpRequest();

    xmlDoc.onreadystatechange = handler;
    xmlDoc.open("GET", "nowShowing.xml");
    xmlDoc.send();

    }
    else
    {
    var errorHappendHere = "Error!";
    xmlDoc = document.implementation.createDocument("","",null);
    }

    items=xmlDoc.getElementsByTagName('item');
    SetRSSTemplates();
    }

    catch(e)
    {
    rssTitle.innerHTML = 'Error occured';
    rssBody.innerHTML = 'Thrown Error:'+e.message+"<br/>Note: "+errorHappendHere;
    }
    }

    /* Set HTML Template
    enables layout to be easily customized, prevent confusion with the layout and codes. */

    function SetRSSTemplates()
    {
    if (rssBody)
    {
    var buffer = "";
    for(var i=0; i< items.length; i++)
    {
    var output = (document.all) ? Replace(rssBody.innerHTML,"(::Link::)",getNode('link',i))
    : Replace(rssBody.innerHTML,"%28::Link::%29",getNode('link',i));
    output = Replace(output,"(::Title::)",getNode('title',i));
    output = Replace(output,"(::Pubdate::)",getNode('pubDate',i));
    output = Replace(output,"(::Description::)",getNode('description',i));
    buffer+=output;
    }
    rssBody.innerHTML = buffer;
    }

    if (rssTitle)
    {
    var output = Replace(rssTitle.innerHTML,"(::Title::)",getNode('title'));
    output = (document.all) ? Replace(output,"(::Link::)",getNode('link'))
    : Replace(output,"%28::Link::%29",getNode('link'));
    output = Replace(output,"(::Description::)",getNode('description'));
    output = Replace(output,"(::Pubdate::)",getNode('pubDate'));
    rssTitle.innerHTML = output;
    }
    }

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: SDK 3rd Ed FP2 Emulator Error - Help!

    Hi doubleuj,

    can you please specify where do you get the 'undefined' value?

    Pit

  5. #5
    Registered User
    Join Date
    Apr 2009
    Posts
    22

    Re: SDK 3rd Ed FP2 Emulator Error - Help!

    Quote Originally Posted by jappit View Post
    Hi doubleuj,

    can you please specify where do you get the 'undefined' value?

    Pit
    The undefined value is the output of what I have gotten from reading the xml through my re-editted javascript, which is weird as it is different from the contents of my xml.

    It only occured when I changed the new ActiveX objects to new XMLHttpRequest, which reads from the particular handler function.

    Why is this so?

Similar Threads

  1. S60 3rd Ed SDK FP2 Beta download
    By ahmedsharaf2006 in forum Symbian Tools & SDKs
    Replies: 4
    Last Post: 2010-07-03, 20:06
  2. Replies: 1
    Last Post: 2008-11-01, 15:09
  3. group_name property on S60 3rd ed. FP2?
    By jappit in forum Symbian
    Replies: 4
    Last Post: 2008-04-21, 14:20
  4. Can Nokia connectivity Framwork work with S60 3rd FP2 SDK?
    By luckyapplehead in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2007-12-18, 12:52
  5. S40 3rd Ed FP2 (5300) Signing not working properly
    By pillar in forum Mobile Java General
    Replies: 8
    Last Post: 2007-05-16, 08:09

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •