2012-04-19 49 views
1

我要去列出从XML文件看起来像这样一些项目:如何读取从XML标签属性HTML

<artist href="spotify:artist:1gR0gsQYfi6joyO1dlp76N"> 
<name>Justice</name> 
<popularity>0.59872</popularity> 
</artist> 

它是由http://ws.spotify.com/search/1/artist?q=justice

我的代码看起来是这样的要求:

var x=xmlDoc.getElementsByTagName("artist"); 
for (i=0;i<x.length;i++) 
{ 
document.write("<tr><td>"); 
document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue); 

document.write("</td><td>"); 
document.write(x[i].getElementsByTagName("popularity")[0].childNodes[0].nodeValue); 

document.write("</td><td>"); 
document.write(x[i].HOW DO I GET THE SPOTIFY URI); 

document.write("</td></tr>"); 
} 
document.write("</table>"); 

一切工作正常,但我不知道如何让Spotify的URL到表

回答