I have just started to learn javascript in the last 3 or 4 days. I am trying to display the contents of an xml file, using examples found on the net.

So far so good, but I can't get the script to display the custom fields.

Points to note

1. The xml file is on another domain, I cannot change it
2. The number of fields is not fixed, a product can have any number of fields including none at all
3. Field name can be anything and they change from product to product

I have posted an example of the xml file and code below.

Thanks in advance for any help given.

<product language="en">
<name>Mens Flip Flop</name>
<description>Flip Flops are comfortable and lightweight</description>
<field name="Age">Adult</field>
<field name="Sex">Male</field>
<field name="Use">Casual</field>
<field name="Type">Flip Flops</field>
<field name="Colour">Black</field>
<field name="Size">7</field>
<product language="en" groupingId="505">
<name>Womens Flip Flop</name>
<description>Flip Flops are comfortable</description>
<field name="Gender">Female</field>
<field name="Use">Casual</field>
<product language="en" groupingId="505">
<name>Womens Pink Flip Flop</name>
<description>Flip Flops are comfortable</description>
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
GetURL = "apixmlurl";

var x=xmlDoc.getElementsByTagName("product");

for (i=0;i<x.length;i++)
var ProductName = getNodeValue(x[i],'name');
var ProductDescription = getNodeValue(x[i],'description');
var ProductSize = getNodeValue(x[i],'size');

if(ProductName > ''){document.write("<b>Name:</b> "+ProductName+"<p>");}
if(ProductDescription > ''){document.write("<b>Description:</b> "+ProductDescription+"<p>");}

// The fields should go here

if(ProductSize > ''){document.write("<b>Size:</b> "+ProductSize+"<p>");}