Unable to access XML from JavaScript.

K

keerthana_m_2003

I am trying to access an XML file from VC++ in a Java Script.
But I am unable to link the XML file. The error whihc I am getting is
Object Expected. Here is the code:

......
xmlDoc.load("Data.xml");
.......
try{
return(xmlDoc.getElementsByTagName(pageNN)[0].firstChild.nodeValue);
}
catch(er)
{
alert("TEST"+er.message);
}
.......

Please let me know, how to resolve this linking issue. Even if the path
is given as absolute path, the same issue happens.

Thanks
 
D

David Dorward

I am trying to access an XML file from VC++

How the data file is generated is pretty much irrelevant.
in a Java Script.
But I am unable to link the XML file. The error whihc I am getting is
Object Expected. Here is the code:

At what line?
xmlDoc.load("Data.xml");

What is xmlDoc? You don't declare it anywhere in the code you provided.
 
K

Kris

return(xmlDoc.getElementsByTagName(pageNN)[0].firstChild.nodeValue);

Try this:
return(xmlDoc.responseXML.getElementsByTagName(pageNN)[0].firstChild.nodeValue);
___________^^^^
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top