The following code is giving me the error “xmldoc.getElementsByTagName(“pspagetitle”)[x] is undefined”. Having said that I can not for the life of me figure it out. I have been staring at this for two hours and I decided to put my ego aside and ask for some help. I know that this something simple I just can’t put my finger on it. So if there are any gurus out there that can help me it would be appreciated.
Note: The initial request for the document is working fine, if I place an alert [I]alert(typeof root);[I]alert(root)
[CODE]
//var xmldoc = http_request.responseXML;
root = xmldoc.getElementsByTagName(“portalsettings”);
alert(typeof root); // <– returns object
alert(root); // <– returns [object HTMLCollection]
for(x = 0; x <= root.length; x++)
{
/*
<portal>
<productinfo>
<!– Product Info Should be Set In This Element –>
<prodline>My Product Line Name</prodline>
<prodserial>V35-OOUN74DH7</prodserial>
<prodmodel>135</prodmodel>
<prodmanfdate>00.00.0000</prodmanfdate>
</productinfo>
<portalsettings>
<!– Portal Information –>
<pspagetitle>Login Portal</pspagetitle>
<pscustomername>Customer Name</pscustomername>
<!– Video Recorder Settings –>
<psheadend>
<headendurl>http://www.video.someniftyurlthatishidden.com</headendurl>
</psheadend>
</portalsettings>
<portal>
*/
// The following line is the one causing my eventual brain aneurysm.
var m_pageTitle = xmldoc.getElementsByTagName(“pspagetitle”)[x].childNodes[0].nodeValue;
var m_customerName = xmldoc.getElementsByTagName(“pscustomername”)[x].childNodes[0].nodeValue;
//Not entirely sure this next line is right.. I have not been able to get past the original problem.
var m_psHeadEndUrl = xmldoc.getElementsByTagName(“psheadend”)[x].childNodes[0].childNodes[0].nodeValue;
$(‘#highlight-black’).append(‘<strong>’ + m_pageTitle + ‘</strong>’);
document.title = m_pageTitle;
alert(m_psHeadEndUrl);
}
Thank you,
John