mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-14 21:51:04 +00:00
Update xml.js
This commit is contained in:
parent
f3628b9887
commit
3050a01ab9
12
lib/xml.js
12
lib/xml.js
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user