×

Discussion Board

Results 1 to 5 of 5

Thread: XML and WRT

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    6

    Angry XML and WRT

    Hi!

    I'm trying to parse an XML file for a widget planned for the Nokia N8.

    I tried to do the read the value of a certain node by using nodeValue. It works just fine in Firefox and the WRT emulator present in Aptana Studio 2.0, but it doesn't work in the Nokia N8.

    Question:
    Does the N8 have support for parsing XML files? Or should I look for another alternative like JSON?

    Thanks in advance!

  2. #2
    Registered User
    Join Date
    Jan 2011
    Posts
    6

    Re: XML and WRT

    OK, it's not necessarily the nodeValue expression, but here's the thing:

    1- There's an XML file with a <DRINKS> tag as a root and three children <DRINK>, which have four children as well.
    2- I collect these children by using xmlDoc.getElementsByTagName("DRINK") and store them in an array called drinks.
    3- I print on the screen how many elements does the array have. It says 3. So far, so good.
    4- I use this alert(drinks[0].childElementCount). It should print 4, and it does so in Firefox and the emulator provided in Aptana Studio 2.0. It prints an empty string on the N8.

    Why is this? Is there any way of fixing this?
    Thanks in advance!

  3. #3
    Registered User
    Join Date
    Jan 2011
    Posts
    6

    Re: XML and WRT

    I already solved it out.

    The thing is, at least the N8 will NOT accept elements like childElementCount or children. I saw it worked mainly with childNodes instead of children. Just a heads up so other people don't waste as much time as I did

  4. #4
    Registered User
    Join Date
    Oct 2010
    Location
    Trivandrum ,Kerala
    Posts
    139

    Re: XML and WRT

    Creat XML DOM object and then extracts from it.
    eg:
    var element = xmlPar.getElementsByTagName("wanted_data");
    var length=element.length;
    var first element=element[0].childNodes[0].nodeValue;
    sreerajvr

  5. #5
    Registered User
    Join Date
    Jan 2011
    Posts
    6

    Re: XML and WRT

    Thanks for the reply sreerajvr!

    Yeah, I realized that was a way to do it. In the end, it was my use of children for extracting the nodes that was causing the problem

Similar Threads

  1. XML Parsing (WRT)
    By somnathbanik in forum Symbian
    Replies: 5
    Last Post: 2011-04-13, 08:11
  2. can i update WRT 1.0 to WRT 1.1 in mobile device
    By vimalrajpara in forum Symbian
    Replies: 2
    Last Post: 2011-01-08, 06:17
  3. How to load local XML file in Flash Lite that is embedded in a WRT Widget?
    By kvirtanen in forum [Archived] Flash Lite on Nokia Devices
    Replies: 3
    Last Post: 2010-04-06, 10:14
  4. WRT XML
    By excell99 in forum Symbian
    Replies: 2
    Last Post: 2009-07-13, 09:26
  5. WRT XML Parser
    By bhanuchandar.k in forum Symbian
    Replies: 5
    Last Post: 2008-12-04, 18:31

Posting Permissions

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