Update xml.js

This commit is contained in:
Namhyeon Go 2020-11-05 12:05:52 +09:00
parent 84ae151055
commit 484d6cc500

View File

@ -16,13 +16,19 @@ var createXMLObject = function() {
};
var loadXMLFile = function(filename) {
var doc = createXMLObject();
var doc;
if (FILE.fileExists(filename)) {
doc.loadXML(FILE.readFile(filename, "utf-8"));
} else {
console.log("The file does not exists");
return;
try {
doc = createXMLObject();
if (FILE.fileExists(filename)) {
doc.loadXML(FILE.readFile(filename, "utf-8"));
} else {
console.error("The file does not exists");
return;
}
} catch(e) {
console.error(e.message);
}
return {