I am parsing an xml which looks like this
<title>abc</title>
<summary>abc</summary>
<content type='application/atom+xml' src='abc'/>
<link rel='alternate' type='application/atom+xml' href='abc'/>
<title>abc</title>
<summary>xyz</summary>
<content type='application/atom+xml' src='xyz'/>
<link rel='alternate' type='application/atom+xml' href='xyz'/>
<title>abc</title>
<summary>abb</summary>
<content type='application/atom+xml' src='abb'/>
<link rel='alternate' type='application/atom+xml' href='abb'/>
My jQuery:
$title.each(function(index)
{
if (index != 0)
{
$("#container").append('<div id=' + index + '></div></br>');
$('#' + index).text($(this).text());
$srcnode = $(xml).find('content')[index];
alert($srcnode.attr('src'));
}
}
I am getting the error as no attr 'src' found for the element. I am trying to fetch the link corresponding to the title which is in content
try to change
$srcnode = $(xml).find('content')[index];
to
$srcnode = $(xml).find('content').eq(index);
(+ you have no "xml" variable.) After you correct it, it should work correctly then