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 loadXMLFile = function(filename) {
var doc = createXMLObject(); var doc;
if (FILE.fileExists(filename)) { try {
doc.loadXML(FILE.readFile(filename, "utf-8")); doc = createXMLObject();
} else {
console.log("The file does not exists"); if (FILE.fileExists(filename)) {
return; doc.loadXML(FILE.readFile(filename, "utf-8"));
} else {
console.error("The file does not exists");
return;
}
} catch(e) {
console.error(e.message);
} }
return { return {