×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    442

    How to get attribute value in widget?

    hi

    We get Node value like

    var node = itemElements[i].firstChild;
    if (node.nodeType == Node.ELEMENT_NODE)
    {
    if (node.nodeName == "description")
    {
    // item description
    description = this.getTextOfNode(node);
    }
    }

    but how to get attributes value?
    if Tag is: <media:content url="http://d.yimg.com/a/p/ap/20090526/capt.b9f09da366124064af9fb28720edb695.south_korea_koreas_nuclear_sel115.jpg?x=125&amp;y=130&amp;q=85&amp;sig=qG_KOSEqfin5CvdXq52BwA--" type="image/jpeg" height="130" width="125"/>

    Regards,
    SymbianTH

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

    Re: How to get attribute value in widget?

    Hi SymbianTH,

    once you have the relevant node, to extract a specific attribute you could use the following code:
    Code:
    var attributeValue = node.attributes.getNamedItem('your_attribute_name').nodeValue;
    node.attributes property contains all the node attributes, and you access a specific attribute by using the getNamedItem() method.

    Hope it helps,
    Pit

  3. #3
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    442

    Re: How to get attribute value in widget?

    Quote Originally Posted by jappit View Post
    Hi SymbianTH,

    once you have the relevant node, to extract a specific attribute you could use the following code:
    Code:
    var attributeValue = node.attributes.getNamedItem('your_attribute_name').nodeValue;
    node.attributes property contains all the node attributes, and you access a specific attribute by using the getNamedItem() method.

    Hope it helps,
    Pit

    Thank you very much, yes I got using your help.

    Thanking you
    SymbianTH

Similar Threads

  1. create and delete widget shortcut icon
    By priti2208 in forum Symbian
    Replies: 9
    Last Post: 2009-07-31, 11:08
  2. Replies: 1
    Last Post: 2009-04-14, 21:52
  3. My widget stopped working. Feed read timeout
    By miklos.szanyi@gmail.com in forum Widsets Development
    Replies: 0
    Last Post: 2009-01-23, 10:00
  4. Replies: 4
    Last Post: 2006-09-05, 15:15

Posting Permissions

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