3 var XMLNode, XMLText, create,
4 extend =
function(child, parent) {
for (var key in parent) {
if (hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype =
new ctor(); child.__super__ = parent.prototype;
return child; },
5 hasProp = {}.hasOwnProperty;
7 create = require(
'lodash/create');
9 XMLNode = require(
'./XMLNode');
11 module.exports = XMLText = (
function(superClass) {
12 extend(XMLText, superClass);
14 function XMLText(parent, text) {
15 XMLText.__super__.constructor.call(
this, parent);
17 throw new Error(
"Missing element text");
19 this.value = this.stringify.eleText(text);
22 XMLText.prototype.clone =
function() {
23 return create(XMLText.prototype,
this);
26 XMLText.prototype.toString =
function(options, level) {
27 var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
28 pretty = (options != null ? options.pretty :
void 0) ||
false;
29 indent = (ref = options != null ? options.indent :
void 0) != null ? ref :
' ';
30 offset = (ref1 = options != null ? options.offset :
void 0) != null ? ref1 : 0;
31 newline = (ref2 = options != null ? options.newline :
void 0) != null ? ref2 :
'\n';
33 space =
new Array(level + offset + 1).join(indent);