I am trying to parse a simple XML file and apply the data in the appropriate input fields. My issue is all the values appear as NULL. Does anyone have any ideas?
my XML:
<?xml version="1.0" ?>
- <entBuyer>
<AreaCode>123</AreaCode>
<PreFix>456</PreFix>
<Suffix>7890</Suffix>
<buyAdd1>1234 ODD LN., SUITE 400</buyAdd1>
<buyAdd2>AUSTIN, TX 78744</buyAdd2>
</entBuyer>
my Javascript:
var xmlDocument = XMLHttpRequestObject.responseXML;
areacode = xmlDocument.getElementsByTagName("AreaCode")[0].nodeValue;
prefix = xmlDocument.getElementsByTagName("PreFix")[0].nodeValue;
suffix = xmlDocument.getElementsByTagName("Suffix")[0].nodeValue;
address1 = xmlDocument.getElementsByTagName("buyAdd1")[0].nodeValue;
address2 = xmlDocument.getElementsByTagName("buyAdd2")[0].nodeValue;
document.getElementById('areaCode').value = areacode;
document.getElementById('preFix').value=prefix;
document.getElementById('sufFix').value=suffix;
document.getElementById('Address1').innerHTML=address1;
document.getElementById('Address2').innerHTML=address2;