Loading xml files through node.js on windows

I'm trying to load and parse a local XML file through Node.js hosted in IIS. I used fs readFile to read the string and the xmldom module to parse it. It works until file size is small (few kb), but if I try to load a 3Mb xml it fails.

Which other xml modulefor windows could perform better?

This is my code

var fs = require('fs');
fs.readFile('C:\\Temp\\TEST.xml', 'ascii', function(err,data){
    if(err) {
        console.log("Could not open file"+ err);
        process.exit(1);
    }
    var Dom = require('xmldom').DOMParser;
    var doc = new Dom().parseFromString(data.substring(2,data.lenght));
    console.log(doc.childNodes[0].localName);
});

After 5 min the xml the parser is still running, while on a simpler example it works. i saved the output from msinfo32 in xml format

After 10 mins output is RangeError: Maximum call stack size exceeded

output is generated from "msinfo32 /nfo C:\TEMP\TEST.NFO"

Just make sure that the xml document is valid here:

http://www.w3schools.com/xml/xml_validator.asp

If it is and it's failing I suggest to open an issue on their github page

You can search for other modules on npm

I've personally used xml2js without problems

msinfo32 outputs in "ucs2", the wrong encoding caused the issue. Xmldom parser works fine, even if it takes a couple of minutes to parse the whole file.

I used xml-splitter to extract the xml branch to be parsed

I see that you wrote lenght and not length... Maybe that's the problem!