Lyandor 0 Newbie Poster

Hey guys, is there a way to get a node's name and assign it as a value to a variable using javascript? Here's an example structure of the xml.

<list>
<student id="101">
<name>John Smith</name>
<DOB>07-09-1987</DOB>
<address>123 ABC street</address>
</student>

<student id="102">
<name>John Doe</name>
<DOB>05-04-1986</DOB>
<address>234 DEF street</address>
<address2>345 GHI street</address>
</list>

what I need to do is to check for student id with and input and create a table with the data, however, the fields of the 2 <student>s are varied. I've figured out how to check for the id, however I'm clueless about getting the node names to place as the fields in the web page. My desired output should be:

=========|================
=name |John Smith =
==========================
=DOB |07-09-1987 =
==========================
=address |123 ABC street =
==========================

Is there a way to read <name>, <DOB> and <address> tag names and then assign it to a variable called fields or the only way to do the fields column is to assign values to them manually?