Create dynamic textboxes from XML

I need to dynamically create a number of dynamic textboxes based on the following:

  1. each textbox is named after a specific nodename
  2. its value is the attribute of that node

Basically I want to loop through an xml object and create a text box for each node, I presume it would work something like this:

//loop through nodes
for (i=0;i < recieveXML.firstChild.firstChild.childNodes.length;i++)
{
// create dynamic tect box
//name after nodename
//assign node attribute as value
}

does anyone know how to achieve this?

Many thanks in advance!