×

Discussion Board

Results 1 to 5 of 5

Thread: xml error

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    4

    xml error

    hi,

    i have a question regarding the use of xml in S60 wrt widget.

    i have this code that retrieve a list of food and info from xml list. it can be executed on a normal web browser but when i load it into the s60 emulator, it gives me this error message :

    TypeError: Value xmldso.load(result of expression xmldso.load) is not object.

    do i need to do/write something for querying , selecting parsing data on the s60 emulator or is it that xml coding cannot be normally executed on the emulator like on normal web browser. which i am not very sure.

    this is the example coding:

    <script type="text/javascript">
    var xmldso=null;
    var xmlRec;
    var tOut;

    function loadXml() {

    if (window.ActiveXObject)
    {// code for IE
    xmldso=new ActiveXObject("Microsoft.XMLDOM");
    }
    else if (document.implementation.createDocument)
    {// code for Mozilla, Firefox, Opera, etc.
    xmldso=document.implementation.createDocument("","",null);
    }
    else
    {
    alert('Your browser cannot handle this script');
    }

    if (xmldso!=null)
    {

    xmldso.async = false;

    try {
    xmldso.load("foodarea.xml");
    } catch (e){
    alert(e.name+":\n"+e.message);
    }
    xmlRec = xmldso.getElementsByTagName("FOOD");
    }

    }

    function searchXml(sFood) {
    loadXml();

    tOut="Record not Found";

    for (i=0;i<xmlRec.length;i++)

    {
    if(xmlRec[i].getElementsByTagName("KIND").item(0).firstChild.nodeValue == sFood)

    {
    if(tOut == "Record not Found") tOut = "";
    tOut+=xmlRec[i].getElementsByTagName("KIND").item(0).firstChild.nodeValue+"<br />";
    tOut+=xmlRec[i].getElementsByTagName("CALORIE").item(0).firstChild.nodeValue+"<br />";
    tOut+=xmlRec[i].getElementsByTagName("FATS").item(0).firstChild.nodeValue+"<br />";
    tOut+=xmlRec[i].getElementsByTagName("WALK").item(0).firstChild.nodeValue+"<br />";
    tOut+=xmlRec[i].getElementsByTagName("JOG").item(0).firstChild.nodeValue+"<br />";
    }
    }
    document.getElementById("oPut").innerHTML=tOut;
    }


    </script>

    </head>

    <body>
    Title: <select name="juice" id="stitle" /><br />
    <option value="Apple Juices">Apple Juices</option>
    <option value="Carrot Juices">Carrot Juices</option>
    <option value="Grapefruit Juices">Grapefruit Juices</option>
    <option value="Orange Juices">Orange Juices</option>
    </select>
    <input type="submit" onclick="searchXml(document.getElementById('stitle').value)" />

    <div id="oPut">
    </div>

    </body>
    </html>

  2. #2
    Registered User
    Join Date
    Jul 2008
    Posts
    4

    Re: xml error

    * this is the example xml

    <FOODS>
    <FOOD>
    <KIND>Orange Juices</KIND>
    <CALORIE>39</CALORIE>
    <FATS>0.2</FATS>
    <WALK>11</WALK>
    <JOG>4</JOG>
    </FOOD>
    <FOOD>
    <KIND>Apple Juices</KIND>
    <CALORIE>45</CALORIE>
    <FATS>0.5</FATS>
    <WALK>11</WALK>
    <JOG>4</JOG>
    </FOOD>

    thanks you for your advise

  3. #3
    Regular Contributor
    Join Date
    Dec 2007
    Posts
    60

    Re: xml error

    Quote Originally Posted by shixiong View Post
    hi,

    i have a question regarding the use of xml in S60 wrt widget.

    i have this code that retrieve a list of food and info from xml list. it can be executed on a normal web browser but when i load it into the s60 emulator, it gives me this error message :

    TypeError: Value xmldso.load(result of expression xmldso.load) is not object.
    Try using the de-facto standard XMLHttpRequest instead and you'll find that you won't have to write any if-blocks on a per-browser basis. XMLHttpRequest works in all modern web browser on all platforms, including WRT on S60.

    You'll find plenty of documentation on XMLHttpRequest on the web, but here's something to get you started:

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

    Peppe

  4. #4
    Registered User
    Join Date
    Nov 2004
    Location
    china
    Posts
    21

    Re: xml error

    maybe you prefer use JSON protocol replace XML when you on nokia mobile device.

  5. #5
    Registered User
    Join Date
    Nov 2008
    Posts
    1

    Re: xml error

    hey shixiong,

    Your problem is probably that you are using async=false. This is supported in the S60-browser of S60v3.2 FP2 at this moment.

    Try not setting async to false and use a callback for onreadystatechange.

Similar Threads

  1. CPbkContactEditorDlg customize
    By asdfghjkl_asdfghjkl in forum Symbian
    Replies: 5
    Last Post: 2008-08-05, 02:56
  2. please help cell id
    By perthachy in forum Symbian
    Replies: 12
    Last Post: 2007-07-10, 13:14
  3. S80 Platform SDK and Visual Studio .NET Linking Error
    By jayantjain in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2005-10-07, 22:14
  4. User break point error in Grid
    By ag24master in forum Symbian User Interface
    Replies: 0
    Last Post: 2003-08-07, 08:20
  5. Unresolved external symbols problem
    By georgica1979 in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-04-06, 13:26

Posting Permissions

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