adding the last element of an xml file.
short:
-------
(How can I count the number of elements in the XML, and like an array get the element with index (i)?)
long:
-------
Hi eveyone,
I'm a newbie and I think my problem is straight forward, however I wasn't able to find anything in the API or by googling.
I have a XML file and it updates every 1/10 second, ( an elements is added to the end of the root).
I want my code to
periodically check the XML the file every 0.5 second,
and add the last element if it's new.
Thus I cant use the basic traverse method explained everywhere:
[code]
$(xml).find('value').each(function(){
//var id = $(this).attr('id');
var id = $(this).find('id').text();
var text = $(this).find('text').text();
var html = '<div class="single_data" id="link_'+id+'"> <i>'+id+'</i> <b id="value">'+text+'</b> </div>';
$('#wrapper').append($(html));
});
[/code]
How can I maybe count the number of elements in the XML, and like an array get the element with index (i)?
thank you,
-Armen