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

The Archive Base Latest Questions

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

is it possible to merge multiple xmlDocuments into one single file (var newResult) by

  • 0

is it possible to merge multiple xmlDocuments into one single file (var newResult) by using jquery (or pure javascript) ?

unfortunately i’ve to combine different hosted xml-documents into one single file (don’t ask me why…). i’ve played around with different techniques, but i can’t find a solution for this (maybe jquery isn’t ready for xml-handling??). thank you 🙂

see my piece of code:

var files = ['john.xml','doe.xml']
var newResult, temp;

function loadMyXMLFiles(){

    // > let's load file by file using jquery's ajax-call:

    $.each(files, function(index,value) { 

      $.ajax({

          url: value,
          cache: true,
          success: function(data){

            // > check if temp is empty, append or fill

            (temp) ? temp += (data) : temp = data;


            // > on complete:

            if (index == files.length-1) {

                xmlResult = temp; temp = null;
            }
          }

      });
  });
}

loadMyXMLFiles()

enter image description here

  • 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-23T14:27:50+00:00Added an answer on May 23, 2026 at 2:27 pm

    As I can see, you are trying to concatenate them. If this is what you need, your code wasn’t that bad,

    var files = ['john.xml','doe.xml']
    var xmlResult, temp = ""; //Make temp an empty string
    
    loadMyXMLFiles(){
        $.each(files, function(index,value) { 
          $.ajax({
              url: value,
              cache: true,
              async: false, //This is crucial!
              success: function(data){
                temp += data;
                if (index == files.length-1) {
                    xmlResult = temp; temp = null;
                }
              }
          });
      });
    }
    

    You have to use async: false so your files arrive in order. But caution, this will hang the browser until the processing is finished. If it’s vital for it not to happen, just tell me.

    Hope this helps. Cheers

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

Sidebar

Related Questions

Is it possible to paqckage multiple rpms into one file. I have got two
I found this neat command to merge multiple PDF into one, using Ghostscript: gs
Possible Duplicate: How to pack multiple library archives (.a) into one archive file? I
Is it possible to merge the below linq query into one query? var checkBoxes
I'm investigating how one can combine multiple PDF's into a single PDF. I'm looking
Is it possible to merge elements using XSLT. If I have the following XML
Is it possible to merge a range of revisions from one branch to another
Using the svnmerge.py tool it is possible to merge between branches, up and down.
Is it possible (or even smart) to pack changes for multiple repositories into a
Is it possible in MySQL to update a single field and select multiple different

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.