Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 642101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:08:05+00:00 2026-05-13T21:08:05+00:00

I am attempting to parse a XML file using Javascript and I’m running into

  • 0

I am attempting to parse a XML file using Javascript and I’m running into issues on IE7.

If I have this code:

function LoadXml()
{
    var xmlPath = document.getElementById("hsTreeviewXmlPath").value;

    var xmlhttp=false;
    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
    // JScript gives us Conditional compilation, we can cope with old IE versions.
    // and security blocked creation of the objects.
     try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      alert("here1");
     } catch (e) {
      try {
       xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
       alert("here2");
      } catch (E) {
       xmlhttp = false;
      }
     }
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
            alert("here3");
        } catch (e) {
            xmlhttp=false;
        }
    }
    if (!xmlhttp && window.createRequest) {
        try {
            xmlhttp = window.createRequest();
            alert("here4");
        } catch (e) {
            xmlhttp=false;
        }
    }

    xmlhttp.open("GET",xmlPath,false);
    xmlhttp.send(null);

    var xmlDoc = xmlhttp.responseXML;

    ParseXml(xmlDoc);
}

function ParseXml(xmlDoc)
{
    var root = xmlDoc.documentElement;
    alert(root);

    for(i=0; i< root.childNodes.length; i++)
    {
        var node = root.childNodes[i];
        if(node.nodeType ==1) //process element nodes (type 1)
        {
            if(node.childNodes.length > 1)
            {
                CreateChildren("hsTreeview",node);
            }
            else
            {
                AddNode("hsTreeview", node);
            }
        }
    }
}

In FF and Chrome this works correctly, adding nodes as it should, but on IE7 I get a scripting error and the specific error:

Object required

This gives a line number relating to the line:

for(i=0; i< root.childNodes.length; i++)
{

The alert box tells me that in IE, the root node, which is being populated from xmlDoc.documentElement is null.

I have confirmed, using the alerts here1 etc that in IE7 it is using the xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); object.

Is there some way to fix this up as it’s really frustrating?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:08:05+00:00Added an answer on May 13, 2026 at 9:08 pm

    Make sure that the XML file is served with the proper text/xml Mime Type.

    Edit Bellow:

    Also make sure that the XML file is served through an http server from the same domain and port as the web page. IE will prevent a web page from accessing URLs outside their originating domain or files on your local computer for security reasons.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to parse an XML file using python expat. I have the
I am attempting to parse an xml file in Javascript while ignoring the namespace
I have become accustomed to using TryParse for attempting to parse unknown types: Dim
I'm attempting to parse load a rather complicated XML schema into a Schema object
ok this is driving me crazy. I have been trying to parse a xml
I'm attempting to parse an XML file, and generate & insert the element data
I have the following XML document which I would like to parse into a
I am using php to parse an XML file, but I get an error
I'm attempting to parse an Oracle trace file using regular expressions. My language of
I'm currently attempting to unmarshal some existing XML into a few classes I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.