Update xml.js

This commit is contained in:
Namhyeon Go 2022-01-18 00:45:23 +09:00 committed by GitHub
parent f3628b9887
commit 3050a01ab9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,6 +117,7 @@ var XMLObject = function(dom) {
} }
this.encode = function(value, type) { this.encode = function(value, type) {
try {
var dom = this.getDOM(); var dom = this.getDOM();
dom.dataType = type; dom.dataType = type;
@ -127,9 +128,13 @@ var XMLObject = function(dom) {
} }
return dom.text; return dom.text;
} catch (e) {
console.error("XMLObject->encode():", e.message);
}
}; };
this.decode = function(value, type) { this.decode = function(value, type) {
try {
var dom = this.getDOM(); var dom = this.getDOM();
dom.dataType = type; dom.dataType = type;
@ -140,9 +145,16 @@ var XMLObject = function(dom) {
} }
return dom.nodeTypedValue; return dom.nodeTypedValue;
} catch (e) {
console.error("XMLObject->decode():", e.message);
}
}; };
}; };
exports.create = function() {
return (new XMLObject());
};
exports.load = function(s) { exports.load = function(s) {
return (new XMLObject()).load(s); return (new XMLObject()).load(s);
}; };