Unable to access XML from JavaScript.

Discussion in 'HTML' started by keerthana_m_2003@yahoo.com, Nov 27, 2005.

  1. Guest

    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
    , Nov 27, 2005
    #1
    1. Advertising

  2. wrote:

    > 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.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Nov 27, 2005
    #2
    1. Advertising

  3. Kris Guest

    On 2005-11-27 15:25:46 +0100, said:

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


    Try this:
    return(xmlDoc.responseXML.getElementsByTagName(pageNN)[0].firstChild.nodeValue);
    ___________^^^^
    Kris, Nov 27, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vikram
    Replies:
    6
    Views:
    635
    Vikram
    Apr 7, 2005
  2. anonymous
    Replies:
    7
    Views:
    5,780
    Andrew Thompson
    Jan 16, 2004
  3. Replies:
    2
    Views:
    111
  4. Jake Barnes
    Replies:
    6
    Views:
    374
    9.co.uk
    Feb 8, 2006
  5. noff
    Replies:
    0
    Views:
    194
Loading...

Share This Page