Examine contents of Javascript variable after some action

I have a function that is supposed to read from a file into a variableI want to know the validity of the reads and was wondering if there was any way I could examine the contents of the variable after the upload action has been performed.\[code\]function handleFileSelect(evt) { var files = evt.target.files; // FileList object // Loop through the FileList for (var i = 0, f; f = files; i++) { var reader = new FileReader(); parser=new DOMParser(); // Closure to capture the file information. reader.onload = (function(theFile) { return function(e) { // Print the contents of the file // var span = document.createElement('span'); xmlDoc=parser.parseFromString(e.target.result,"text/xml"); try{ DistributomeXML_Objects=xmlDoc.documentElement.childNodes; }catch(error){ DistributomeXML_Objects=xmlDoc.childNodes; } //document.getElementById('list').insertBefore(span, null); }; })(f); // Read in the file //reader.readAsDataText(f,UTF-8); reader.readAsText(f); } //xmlDoc.getElementsByTagName("distributome").item(0).appendChild(node); traverseXML(false, null, DistributomeXML_Objects, distributome.nodes, distributome.edges, distributome.references, distributomeNodes, referenceNodes);}\[/code\]I want to check if xmlDoc is valid. What would be a good way to do this without using print statements.
 
Back
Top