I'm trying to read some information from a local XML document however i cant figure out how to do it.
I'm able to include js(and read data from them) css and all those kind of files but how do i read from an XML file or any other file.
The XML file is in the same directory as the js file so why shouldn't i be able to read it like any other js file?
I know it's possible to read files using nodejs but i'm trying to read the xml data and display it in a html page so it has to be client side.
// kan tijdelijk delayreport in js file zetten
var fs = require('browserify-fs'),
xml2js = require('xml2js');
var parser = new xml2js.Parser();
fs.readFile('delayReport.xml', function(err, data) {
parser.parseString(data, function (err, result) {
//console.dir(JSON.stringify(result,null,2));
console.log('Done');
console.log(result);
});
});
xhttp.open("GET", "delayReport.xml", true);