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 6998327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:23:51+00:00 2026-05-27T20:23:51+00:00

what is the best way to change(without jquery) these html/javascript to work with ie9,

  • 0

what is the best way to change(without jquery) these html/javascript to work with ie9,

<html>
    <body>
        <div id="xmls">
            <xml id="myXml">
                <bookstore>
                    <book category="COOKING">
                        <title lang="en">Everyday Italian</title>
                        <author>Giada De Laurentiis</author>
                        <year>2005</year>
                        <price>30.00</price>
                    </book>
                </bookstore>
            </xml>
        </div>
        <!-- ...more html -->
    </body>
</html>

And read this html section with script

function readBooks() {
    var doc = null;
    try {
        doc = document.getElementById("myXml").XMLDocument.documentElement.childNodes.length;
        alert('msg =' + doc);
        //i need child nodes to iterate and show values,
    } catch (ex) {
        alert("problems to load xml" + doc);
        throw ex;
    }
}

these works fine with ie6,7,8.

but with with ie9 not.

the XMLDocument property is undefined,

thanks,

  • 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-27T20:23:52+00:00Added an answer on May 27, 2026 at 8:23 pm

    the following seemed fine in modern browsers

    function readBooks() {
          var doc;
          try {
              doc = document.getElementById("myXml")
              alert('msg =' + doc.childNodes.length);
              for (var i = 0; i < doc.childNodes.length; i++) {
                if(doc.childNodes[i].tagName && doc.childNodes[i].tagName.toUpperCase() == "BOOKSTORE") {
    
                    for (var j = 0; j < doc.childNodes[i].childNodes.length; j++) {
                        if (doc.childNodes[i].childNodes[j].tagName && doc.childNodes[i].childNodes[j].tagName.toUpperCase() == "BOOK") {
                            var book = doc.childNodes[i].childNodes[j];
                            alert(book.getAttribute("category"));
                            alert(getNodeValue(book.getElementsByTagName("title")[0]));
                            alert(getNodeValue(book.getElementsByTagName("author")[0]));
                            alert(getNodeValue(book.getElementsByTagName("year")[0]));
                            alert(getNodeValue(book.getElementsByTagName("price")[0]));
                        }
                    }
                }
              }
          } catch (ex) {
              alert("problems to load xml" + doc);
              throw ex;
          }
      }
    
      function getNodeValue(node) {
    
          if (node.text)
              return node.text;
          return node.innerHTML;
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best way to change a user-password remotely in Unix? This must
What is the best way to change the height and width of an ASP.NET
what is the best way to change the toolbars in Zimbra. Zimbra does have
What is the best way to catch a < select > change event? I
Can anyone recommend the best way to change the default language in Sitecore 6.1.
What is the best way to change a single byte in a file using
What is the best way deal with out-of-sequence Ajax requests (preferably using a jQuery)?
What is the best way (without js) to make all cells align (ie, have
Looking for the best way to do ownership validation in a Rails model without
What is the best way to send values from JavaScript (client-side) to the server

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.