<commit_before>var xmlParser = require("xml2json"),
fs = require("fs"),
thisView, viewFunction, result, inputData, outputRoutine;

// Get arguments
var filename = process.argv[2], viewname = process.argv[3];

// Open the file
//var curDir = process.cwd();
var filepath = __dirname + "/test-files/" + filename;
fs.readFile(filepath, function(err, data) {
	if (err) throw err;
	else {
		
		if (viewname.match(/input/)) {
			inputData = xmlParser.toJson(data, { object: true, reversible: true });<commit_msg>Added try-catch to deal with situations where xml2json can't parse the input document<commit_after>var xmlParser = require("xml2json"),
fs = require("fs"),
thisView, viewFunction, result, inputData, outputRoutine;

// Get arguments
var filename = process.argv[2], viewname = process.argv[3];

// Open the file
//var curDir = process.cwd();
var filepath = __dirname + "/test-files/" + filename;
fs.readFile(filepath, function(err, data) {
	if (err) throw err;
	else {
		
		if (viewname.match(/input/)) {
			try { inputData = xmlParser.toJson(data, { object: true, reversible: true }); }
			catch(err) { throw err; }
{'fraction_non_alphanumeric': 0.15102770330652368, 'fraction_numerical': 0.006255585344057194, 'mean_word_length': 4.5721393034825875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 7}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5540834', 'n_tokens_mistral': 373, 'n_tokens_neox': 355, 'n_words': 104}