Accepted answer

There's really two parts to this question:

  1. How do I get a list of server-side files to client-side JavaScript?

Short answer is you don't without having a server-side api that can return that list. Depending on what backend you are using, you write a method that returns a JSON array of the files in your target directory. You call this first, get the response and then process them all with queue:

d3.json('/get/list/of/xml/files', function(error, fileArray){
  var q = d3.queue();
    q = q.defer(d3.xml, d);
  1. How do a process a variable number of arguments in JavaScript?

This is actually very well supported in JavaScript.

function analyze(error) {
  if(error) { console.log(error); }

  // skip 0 it's error variable
  for (i = 1; i < arguments.length; i++) {
    var xml = arguments[i];

Related Query