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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:25:46+00:00 2026-06-10T19:25:46+00:00

I am using the below code to read one xml file which is located

  • 0

I am using the below code to read one xml file which is located locally. But its not displaying the object of xmldoc. My code is

function loadXMLDoc(XMLname)
{
  var xmlDoc;
  if (window.XMLHttpRequest)
    {
    xmlDoc=new window.XMLHttpRequest();
    xmlDoc.open("GET",XMLname,false);
     xmlDoc.send("");
     return xmlDoc.responseXML;
   }

   else if (ActiveXObject("Microsoft.XMLDOM"))
   {
   xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async=false;
   xmlDoc.load(XMLname);
   return xmlDoc;
   }
   alert("Error loading document!");
   return null;
   }



   function f1()
   {
   var xmlDoc=loadXMLDoc(“test.xml”)
   var M = xmlDoc.getElementsByTagName(“article”);
   alert(M);
     }

Its not displaying the alert if i call the function f1.Thanks in advance

  • 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-06-10T19:25:47+00:00Added an answer on June 10, 2026 at 7:25 pm

    Better use Jquery function. Its working fine for me.

    <script src="jquery.js" type="text/javascript"></script>
    <script>
    $(document).ready(function(){
    $.ajax({
        type: "GET",
        url: "read2.xml",
        dataType: "xml",
        success: function(xml) {
            $(xml).find('site').each(function(){
    
                var id = $(this).attr('id');
                var title = $(this).find('title').text();
                var url = $(this).find('url').text();
                $(this).find('desc').each(function()
                {
                    var brief = $(this).find('brief').text();
                    var long = $(this).find('long').text();
                    alert("my "+brief );
                    alert("my "+long );
    
                });
            });
        }
    });
    });
    

    And the XML file format will be

    my title1
    url1

    brf 1
    long 1

    brf 2
    long 2

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

Sidebar

Related Questions

I am using the below code to read data from a text file row
Question: Using VB.NET/C#, is it really not possible to read the below XML in
I'm writing to a text file using the code below. the setup is: read
I was uploading my file using below code,it works fine but some time it
In the below code, using (SqlDataReader dr = com.ExecuteReader(CommandBehavior.CloseConnection)) { while (dr.Read()) { _emailTemplate.EmailContent
I was trying to read a lot of numbers dynamically using the code below
I am using below code to show jquery dialog, its working perfectly, Sub OpenDialog(ByVal
Currently i'm using below code which works well. $(#topperAtBaseLevel:visible, #lowerAtBaseLevel:visible, #midAtBaseLevel).hide(); any optimised code?
I'm using the below code to transfer an image from one folder on external
Hi I have big xml file which has a structure similar to the one

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.