Get n element of an XML file using JavaScript DOM

S

SM

I have an XML that contains all the CDs from one artist only.
If the user requests more info on cd #2, then all the tracks from the
cd#2 are shown to him.

How do i achieve that?

Heres how my XML look like

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<discography>
<cd>
<title>CD1</title>
<track>
<title>track01</title>
<title>track02</title>
<title>track03</title>
<title>track04</title>
<title>track05</title>
<title>track06</title>
<title>track07</title>
<title>track08</title>
<title>track09</title>
<title>track10</title>
</track>
</cd>
<cd>
<title>CD2</title>
<track>
<title>track01</title>
<title>track02</title>
<title>track03</title>
</track>
</cd>
</discography>


....
var xmlResponse = xmlHttp.responseXML;
xmlRoot = xmlResponse.documentElement;
....


Thanks
Marco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,692
Latest member
JenniferTi

Latest Threads

Top