selenium
This commit is contained in:
32
node_modules/xmlbuilder/lib/XMLAttribute.js
generated
vendored
Normal file
32
node_modules/xmlbuilder/lib/XMLAttribute.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLAttribute, create;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
module.exports = XMLAttribute = (function() {
|
||||
function XMLAttribute(parent, name, value) {
|
||||
this.stringify = parent.stringify;
|
||||
if (name == null) {
|
||||
throw new Error("Missing attribute name of element " + parent.name);
|
||||
}
|
||||
if (value == null) {
|
||||
throw new Error("Missing attribute value for attribute " + name + " of element " + parent.name);
|
||||
}
|
||||
this.name = this.stringify.attName(name);
|
||||
this.value = this.stringify.attValue(value);
|
||||
}
|
||||
|
||||
XMLAttribute.prototype.clone = function() {
|
||||
return create(XMLAttribute.prototype, this);
|
||||
};
|
||||
|
||||
XMLAttribute.prototype.toString = function(options, level) {
|
||||
return ' ' + this.name + '="' + this.value + '"';
|
||||
};
|
||||
|
||||
return XMLAttribute;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
69
node_modules/xmlbuilder/lib/XMLBuilder.js
generated
vendored
Normal file
69
node_modules/xmlbuilder/lib/XMLBuilder.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLBuilder, XMLDeclaration, XMLDocType, XMLElement, XMLStringifier;
|
||||
|
||||
XMLStringifier = require('./XMLStringifier');
|
||||
|
||||
XMLDeclaration = require('./XMLDeclaration');
|
||||
|
||||
XMLDocType = require('./XMLDocType');
|
||||
|
||||
XMLElement = require('./XMLElement');
|
||||
|
||||
module.exports = XMLBuilder = (function() {
|
||||
function XMLBuilder(name, options) {
|
||||
var root, temp;
|
||||
if (name == null) {
|
||||
throw new Error("Root element needs a name");
|
||||
}
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
this.options = options;
|
||||
this.stringify = new XMLStringifier(options);
|
||||
temp = new XMLElement(this, 'doc');
|
||||
root = temp.element(name);
|
||||
root.isRoot = true;
|
||||
root.documentObject = this;
|
||||
this.rootObject = root;
|
||||
if (!options.headless) {
|
||||
root.declaration(options);
|
||||
if ((options.pubID != null) || (options.sysID != null)) {
|
||||
root.doctype(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XMLBuilder.prototype.root = function() {
|
||||
return this.rootObject;
|
||||
};
|
||||
|
||||
XMLBuilder.prototype.end = function(options) {
|
||||
return this.toString(options);
|
||||
};
|
||||
|
||||
XMLBuilder.prototype.toString = function(options) {
|
||||
var indent, newline, offset, pretty, r, ref, ref1, ref2;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
r = '';
|
||||
if (this.xmldec != null) {
|
||||
r += this.xmldec.toString(options);
|
||||
}
|
||||
if (this.doctype != null) {
|
||||
r += this.doctype.toString(options);
|
||||
}
|
||||
r += this.rootObject.toString(options);
|
||||
if (pretty && r.slice(-newline.length) === newline) {
|
||||
r = r.slice(0, -newline.length);
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
return XMLBuilder;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
49
node_modules/xmlbuilder/lib/XMLCData.js
generated
vendored
Normal file
49
node_modules/xmlbuilder/lib/XMLCData.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLCData, XMLNode, create,
|
||||
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; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
XMLNode = require('./XMLNode');
|
||||
|
||||
module.exports = XMLCData = (function(superClass) {
|
||||
extend(XMLCData, superClass);
|
||||
|
||||
function XMLCData(parent, text) {
|
||||
XMLCData.__super__.constructor.call(this, parent);
|
||||
if (text == null) {
|
||||
throw new Error("Missing CDATA text");
|
||||
}
|
||||
this.text = this.stringify.cdata(text);
|
||||
}
|
||||
|
||||
XMLCData.prototype.clone = function() {
|
||||
return create(XMLCData.prototype, this);
|
||||
};
|
||||
|
||||
XMLCData.prototype.toString = function(options, level) {
|
||||
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += '<![CDATA[' + this.text + ']]>';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
return XMLCData;
|
||||
|
||||
})(XMLNode);
|
||||
|
||||
}).call(this);
|
||||
49
node_modules/xmlbuilder/lib/XMLComment.js
generated
vendored
Normal file
49
node_modules/xmlbuilder/lib/XMLComment.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLComment, XMLNode, create,
|
||||
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; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
XMLNode = require('./XMLNode');
|
||||
|
||||
module.exports = XMLComment = (function(superClass) {
|
||||
extend(XMLComment, superClass);
|
||||
|
||||
function XMLComment(parent, text) {
|
||||
XMLComment.__super__.constructor.call(this, parent);
|
||||
if (text == null) {
|
||||
throw new Error("Missing comment text");
|
||||
}
|
||||
this.text = this.stringify.comment(text);
|
||||
}
|
||||
|
||||
XMLComment.prototype.clone = function() {
|
||||
return create(XMLComment.prototype, this);
|
||||
};
|
||||
|
||||
XMLComment.prototype.toString = function(options, level) {
|
||||
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += '<!-- ' + this.text + ' -->';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
return XMLComment;
|
||||
|
||||
})(XMLNode);
|
||||
|
||||
}).call(this);
|
||||
68
node_modules/xmlbuilder/lib/XMLDTDAttList.js
generated
vendored
Normal file
68
node_modules/xmlbuilder/lib/XMLDTDAttList.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLDTDAttList, create;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
module.exports = XMLDTDAttList = (function() {
|
||||
function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
||||
this.stringify = parent.stringify;
|
||||
if (elementName == null) {
|
||||
throw new Error("Missing DTD element name");
|
||||
}
|
||||
if (attributeName == null) {
|
||||
throw new Error("Missing DTD attribute name");
|
||||
}
|
||||
if (!attributeType) {
|
||||
throw new Error("Missing DTD attribute type");
|
||||
}
|
||||
if (!defaultValueType) {
|
||||
throw new Error("Missing DTD attribute default");
|
||||
}
|
||||
if (defaultValueType.indexOf('#') !== 0) {
|
||||
defaultValueType = '#' + defaultValueType;
|
||||
}
|
||||
if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
|
||||
throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");
|
||||
}
|
||||
if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
|
||||
throw new Error("Default value only applies to #FIXED or #DEFAULT");
|
||||
}
|
||||
this.elementName = this.stringify.eleName(elementName);
|
||||
this.attributeName = this.stringify.attName(attributeName);
|
||||
this.attributeType = this.stringify.dtdAttType(attributeType);
|
||||
this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
|
||||
this.defaultValueType = defaultValueType;
|
||||
}
|
||||
|
||||
XMLDTDAttList.prototype.toString = function(options, level) {
|
||||
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += '<!ATTLIST ' + this.elementName + ' ' + this.attributeName + ' ' + this.attributeType;
|
||||
if (this.defaultValueType !== '#DEFAULT') {
|
||||
r += ' ' + this.defaultValueType;
|
||||
}
|
||||
if (this.defaultValue) {
|
||||
r += ' "' + this.defaultValue + '"';
|
||||
}
|
||||
r += '>';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
return XMLDTDAttList;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
46
node_modules/xmlbuilder/lib/XMLDTDElement.js
generated
vendored
Normal file
46
node_modules/xmlbuilder/lib/XMLDTDElement.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLDTDElement, create;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
module.exports = XMLDTDElement = (function() {
|
||||
function XMLDTDElement(parent, name, value) {
|
||||
this.stringify = parent.stringify;
|
||||
if (name == null) {
|
||||
throw new Error("Missing DTD element name");
|
||||
}
|
||||
if (!value) {
|
||||
value = '(#PCDATA)';
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value = '(' + value.join(',') + ')';
|
||||
}
|
||||
this.name = this.stringify.eleName(name);
|
||||
this.value = this.stringify.dtdElementValue(value);
|
||||
}
|
||||
|
||||
XMLDTDElement.prototype.toString = function(options, level) {
|
||||
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += '<!ELEMENT ' + this.name + ' ' + this.value + '>';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
return XMLDTDElement;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
84
node_modules/xmlbuilder/lib/XMLDTDEntity.js
generated
vendored
Normal file
84
node_modules/xmlbuilder/lib/XMLDTDEntity.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLDTDEntity, create, isObject;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
isObject = require('lodash/lang/isObject');
|
||||
|
||||
module.exports = XMLDTDEntity = (function() {
|
||||
function XMLDTDEntity(parent, pe, name, value) {
|
||||
this.stringify = parent.stringify;
|
||||
if (name == null) {
|
||||
throw new Error("Missing entity name");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new Error("Missing entity value");
|
||||
}
|
||||
this.pe = !!pe;
|
||||
this.name = this.stringify.eleName(name);
|
||||
if (!isObject(value)) {
|
||||
this.value = this.stringify.dtdEntityValue(value);
|
||||
} else {
|
||||
if (!value.pubID && !value.sysID) {
|
||||
throw new Error("Public and/or system identifiers are required for an external entity");
|
||||
}
|
||||
if (value.pubID && !value.sysID) {
|
||||
throw new Error("System identifier is required for a public external entity");
|
||||
}
|
||||
if (value.pubID != null) {
|
||||
this.pubID = this.stringify.dtdPubID(value.pubID);
|
||||
}
|
||||
if (value.sysID != null) {
|
||||
this.sysID = this.stringify.dtdSysID(value.sysID);
|
||||
}
|
||||
if (value.nData != null) {
|
||||
this.nData = this.stringify.dtdNData(value.nData);
|
||||
}
|
||||
if (this.pe && this.nData) {
|
||||
throw new Error("Notation declaration is not allowed in a parameter entity");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XMLDTDEntity.prototype.toString = function(options, level) {
|
||||
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += '<!ENTITY';
|
||||
if (this.pe) {
|
||||
r += ' %';
|
||||
}
|
||||
r += ' ' + this.name;
|
||||
if (this.value) {
|
||||
r += ' "' + this.value + '"';
|
||||
} else {
|
||||
if (this.pubID && this.sysID) {
|
||||
r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"';
|
||||
} else if (this.sysID) {
|
||||
r += ' SYSTEM "' + this.sysID + '"';
|
||||
}
|
||||
if (this.nData) {
|
||||
r += ' NDATA ' + this.nData;
|
||||
}
|
||||
}
|
||||
r += '>';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
return XMLDTDEntity;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
56
node_modules/xmlbuilder/lib/XMLDTDNotation.js
generated
vendored
Normal file
56
node_modules/xmlbuilder/lib/XMLDTDNotation.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLDTDNotation, create;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
module.exports = XMLDTDNotation = (function() {
|
||||
function XMLDTDNotation(parent, name, value) {
|
||||
this.stringify = parent.stringify;
|
||||
if (name == null) {
|
||||
throw new Error("Missing notation name");
|
||||
}
|
||||
if (!value.pubID && !value.sysID) {
|
||||
throw new Error("Public or system identifiers are required for an external entity");
|
||||
}
|
||||
this.name = this.stringify.eleName(name);
|
||||
if (value.pubID != null) {
|
||||
this.pubID = this.stringify.dtdPubID(value.pubID);
|
||||
}
|
||||
if (value.sysID != null) {
|
||||
this.sysID = this.stringify.dtdSysID(value.sysID);
|
||||
}
|
||||
}
|
||||
|
||||
XMLDTDNotation.prototype.toString = function(options, level) {
|
||||
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += '<!NOTATION ' + this.name;
|
||||
if (this.pubID && this.sysID) {
|
||||
r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"';
|
||||
} else if (this.pubID) {
|
||||
r += ' PUBLIC "' + this.pubID + '"';
|
||||
} else if (this.sysID) {
|
||||
r += ' SYSTEM "' + this.sysID + '"';
|
||||
}
|
||||
r += '>';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
return XMLDTDNotation;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
65
node_modules/xmlbuilder/lib/XMLDeclaration.js
generated
vendored
Normal file
65
node_modules/xmlbuilder/lib/XMLDeclaration.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLDeclaration, XMLNode, create, isObject,
|
||||
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; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
isObject = require('lodash/lang/isObject');
|
||||
|
||||
XMLNode = require('./XMLNode');
|
||||
|
||||
module.exports = XMLDeclaration = (function(superClass) {
|
||||
extend(XMLDeclaration, superClass);
|
||||
|
||||
function XMLDeclaration(parent, version, encoding, standalone) {
|
||||
var ref;
|
||||
XMLDeclaration.__super__.constructor.call(this, parent);
|
||||
if (isObject(version)) {
|
||||
ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
|
||||
}
|
||||
if (!version) {
|
||||
version = '1.0';
|
||||
}
|
||||
this.version = this.stringify.xmlVersion(version);
|
||||
if (encoding != null) {
|
||||
this.encoding = this.stringify.xmlEncoding(encoding);
|
||||
}
|
||||
if (standalone != null) {
|
||||
this.standalone = this.stringify.xmlStandalone(standalone);
|
||||
}
|
||||
}
|
||||
|
||||
XMLDeclaration.prototype.toString = function(options, level) {
|
||||
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += '<?xml';
|
||||
r += ' version="' + this.version + '"';
|
||||
if (this.encoding != null) {
|
||||
r += ' encoding="' + this.encoding + '"';
|
||||
}
|
||||
if (this.standalone != null) {
|
||||
r += ' standalone="' + this.standalone + '"';
|
||||
}
|
||||
r += '?>';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
return XMLDeclaration;
|
||||
|
||||
})(XMLNode);
|
||||
|
||||
}).call(this);
|
||||
188
node_modules/xmlbuilder/lib/XMLDocType.js
generated
vendored
Normal file
188
node_modules/xmlbuilder/lib/XMLDocType.js
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLProcessingInstruction, create, isObject;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
isObject = require('lodash/lang/isObject');
|
||||
|
||||
XMLCData = require('./XMLCData');
|
||||
|
||||
XMLComment = require('./XMLComment');
|
||||
|
||||
XMLDTDAttList = require('./XMLDTDAttList');
|
||||
|
||||
XMLDTDEntity = require('./XMLDTDEntity');
|
||||
|
||||
XMLDTDElement = require('./XMLDTDElement');
|
||||
|
||||
XMLDTDNotation = require('./XMLDTDNotation');
|
||||
|
||||
XMLProcessingInstruction = require('./XMLProcessingInstruction');
|
||||
|
||||
module.exports = XMLDocType = (function() {
|
||||
function XMLDocType(parent, pubID, sysID) {
|
||||
var ref, ref1;
|
||||
this.documentObject = parent;
|
||||
this.stringify = this.documentObject.stringify;
|
||||
this.children = [];
|
||||
if (isObject(pubID)) {
|
||||
ref = pubID, pubID = ref.pubID, sysID = ref.sysID;
|
||||
}
|
||||
if (sysID == null) {
|
||||
ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1];
|
||||
}
|
||||
if (pubID != null) {
|
||||
this.pubID = this.stringify.dtdPubID(pubID);
|
||||
}
|
||||
if (sysID != null) {
|
||||
this.sysID = this.stringify.dtdSysID(sysID);
|
||||
}
|
||||
}
|
||||
|
||||
XMLDocType.prototype.element = function(name, value) {
|
||||
var child;
|
||||
child = new XMLDTDElement(this, name, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
||||
var child;
|
||||
child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLDocType.prototype.entity = function(name, value) {
|
||||
var child;
|
||||
child = new XMLDTDEntity(this, false, name, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLDocType.prototype.pEntity = function(name, value) {
|
||||
var child;
|
||||
child = new XMLDTDEntity(this, true, name, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLDocType.prototype.notation = function(name, value) {
|
||||
var child;
|
||||
child = new XMLDTDNotation(this, name, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLDocType.prototype.cdata = function(value) {
|
||||
var child;
|
||||
child = new XMLCData(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLDocType.prototype.comment = function(value) {
|
||||
var child;
|
||||
child = new XMLComment(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLDocType.prototype.instruction = function(target, value) {
|
||||
var child;
|
||||
child = new XMLProcessingInstruction(this, target, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLDocType.prototype.root = function() {
|
||||
return this.documentObject.root();
|
||||
};
|
||||
|
||||
XMLDocType.prototype.document = function() {
|
||||
return this.documentObject;
|
||||
};
|
||||
|
||||
XMLDocType.prototype.toString = function(options, level) {
|
||||
var child, i, indent, len, newline, offset, pretty, r, ref, ref1, ref2, ref3, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += '<!DOCTYPE ' + this.root().name;
|
||||
if (this.pubID && this.sysID) {
|
||||
r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"';
|
||||
} else if (this.sysID) {
|
||||
r += ' SYSTEM "' + this.sysID + '"';
|
||||
}
|
||||
if (this.children.length > 0) {
|
||||
r += ' [';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
ref3 = this.children;
|
||||
for (i = 0, len = ref3.length; i < len; i++) {
|
||||
child = ref3[i];
|
||||
r += child.toString(options, level + 1);
|
||||
}
|
||||
r += ']';
|
||||
}
|
||||
r += '>';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
XMLDocType.prototype.ele = function(name, value) {
|
||||
return this.element(name, value);
|
||||
};
|
||||
|
||||
XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
||||
return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
|
||||
};
|
||||
|
||||
XMLDocType.prototype.ent = function(name, value) {
|
||||
return this.entity(name, value);
|
||||
};
|
||||
|
||||
XMLDocType.prototype.pent = function(name, value) {
|
||||
return this.pEntity(name, value);
|
||||
};
|
||||
|
||||
XMLDocType.prototype.not = function(name, value) {
|
||||
return this.notation(name, value);
|
||||
};
|
||||
|
||||
XMLDocType.prototype.dat = function(value) {
|
||||
return this.cdata(value);
|
||||
};
|
||||
|
||||
XMLDocType.prototype.com = function(value) {
|
||||
return this.comment(value);
|
||||
};
|
||||
|
||||
XMLDocType.prototype.ins = function(target, value) {
|
||||
return this.instruction(target, value);
|
||||
};
|
||||
|
||||
XMLDocType.prototype.up = function() {
|
||||
return this.root();
|
||||
};
|
||||
|
||||
XMLDocType.prototype.doc = function() {
|
||||
return this.document();
|
||||
};
|
||||
|
||||
return XMLDocType;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
212
node_modules/xmlbuilder/lib/XMLElement.js
generated
vendored
Normal file
212
node_modules/xmlbuilder/lib/XMLElement.js
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLAttribute, XMLElement, XMLNode, XMLProcessingInstruction, create, every, isFunction, isObject,
|
||||
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; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
isObject = require('lodash/lang/isObject');
|
||||
|
||||
isFunction = require('lodash/lang/isFunction');
|
||||
|
||||
every = require('lodash/collection/every');
|
||||
|
||||
XMLNode = require('./XMLNode');
|
||||
|
||||
XMLAttribute = require('./XMLAttribute');
|
||||
|
||||
XMLProcessingInstruction = require('./XMLProcessingInstruction');
|
||||
|
||||
module.exports = XMLElement = (function(superClass) {
|
||||
extend(XMLElement, superClass);
|
||||
|
||||
function XMLElement(parent, name, attributes) {
|
||||
XMLElement.__super__.constructor.call(this, parent);
|
||||
if (name == null) {
|
||||
throw new Error("Missing element name");
|
||||
}
|
||||
this.name = this.stringify.eleName(name);
|
||||
this.children = [];
|
||||
this.instructions = [];
|
||||
this.attributes = {};
|
||||
if (attributes != null) {
|
||||
this.attribute(attributes);
|
||||
}
|
||||
}
|
||||
|
||||
XMLElement.prototype.clone = function() {
|
||||
var att, attName, clonedSelf, i, len, pi, ref, ref1;
|
||||
clonedSelf = create(XMLElement.prototype, this);
|
||||
if (clonedSelf.isRoot) {
|
||||
clonedSelf.documentObject = null;
|
||||
}
|
||||
clonedSelf.attributes = {};
|
||||
ref = this.attributes;
|
||||
for (attName in ref) {
|
||||
if (!hasProp.call(ref, attName)) continue;
|
||||
att = ref[attName];
|
||||
clonedSelf.attributes[attName] = att.clone();
|
||||
}
|
||||
clonedSelf.instructions = [];
|
||||
ref1 = this.instructions;
|
||||
for (i = 0, len = ref1.length; i < len; i++) {
|
||||
pi = ref1[i];
|
||||
clonedSelf.instructions.push(pi.clone());
|
||||
}
|
||||
clonedSelf.children = [];
|
||||
this.children.forEach(function(child) {
|
||||
var clonedChild;
|
||||
clonedChild = child.clone();
|
||||
clonedChild.parent = clonedSelf;
|
||||
return clonedSelf.children.push(clonedChild);
|
||||
});
|
||||
return clonedSelf;
|
||||
};
|
||||
|
||||
XMLElement.prototype.attribute = function(name, value) {
|
||||
var attName, attValue;
|
||||
if (name != null) {
|
||||
name = name.valueOf();
|
||||
}
|
||||
if (isObject(name)) {
|
||||
for (attName in name) {
|
||||
if (!hasProp.call(name, attName)) continue;
|
||||
attValue = name[attName];
|
||||
this.attribute(attName, attValue);
|
||||
}
|
||||
} else {
|
||||
if (isFunction(value)) {
|
||||
value = value.apply();
|
||||
}
|
||||
if (!this.options.skipNullAttributes || (value != null)) {
|
||||
this.attributes[name] = new XMLAttribute(this, name, value);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLElement.prototype.removeAttribute = function(name) {
|
||||
var attName, i, len;
|
||||
if (name == null) {
|
||||
throw new Error("Missing attribute name");
|
||||
}
|
||||
name = name.valueOf();
|
||||
if (Array.isArray(name)) {
|
||||
for (i = 0, len = name.length; i < len; i++) {
|
||||
attName = name[i];
|
||||
delete this.attributes[attName];
|
||||
}
|
||||
} else {
|
||||
delete this.attributes[name];
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLElement.prototype.instruction = function(target, value) {
|
||||
var i, insTarget, insValue, instruction, len;
|
||||
if (target != null) {
|
||||
target = target.valueOf();
|
||||
}
|
||||
if (value != null) {
|
||||
value = value.valueOf();
|
||||
}
|
||||
if (Array.isArray(target)) {
|
||||
for (i = 0, len = target.length; i < len; i++) {
|
||||
insTarget = target[i];
|
||||
this.instruction(insTarget);
|
||||
}
|
||||
} else if (isObject(target)) {
|
||||
for (insTarget in target) {
|
||||
if (!hasProp.call(target, insTarget)) continue;
|
||||
insValue = target[insTarget];
|
||||
this.instruction(insTarget, insValue);
|
||||
}
|
||||
} else {
|
||||
if (isFunction(value)) {
|
||||
value = value.apply();
|
||||
}
|
||||
instruction = new XMLProcessingInstruction(this, target, value);
|
||||
this.instructions.push(instruction);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLElement.prototype.toString = function(options, level) {
|
||||
var att, child, i, indent, instruction, j, len, len1, name, newline, offset, pretty, r, ref, ref1, ref2, ref3, ref4, ref5, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
ref3 = this.instructions;
|
||||
for (i = 0, len = ref3.length; i < len; i++) {
|
||||
instruction = ref3[i];
|
||||
r += instruction.toString(options, level);
|
||||
}
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += '<' + this.name;
|
||||
ref4 = this.attributes;
|
||||
for (name in ref4) {
|
||||
if (!hasProp.call(ref4, name)) continue;
|
||||
att = ref4[name];
|
||||
r += att.toString(options);
|
||||
}
|
||||
if (this.children.length === 0 || every(this.children, function(e) {
|
||||
return e.value === '';
|
||||
})) {
|
||||
r += '/>';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
} else if (pretty && this.children.length === 1 && (this.children[0].value != null)) {
|
||||
r += '>';
|
||||
r += this.children[0].value;
|
||||
r += '</' + this.name + '>';
|
||||
r += newline;
|
||||
} else {
|
||||
r += '>';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
ref5 = this.children;
|
||||
for (j = 0, len1 = ref5.length; j < len1; j++) {
|
||||
child = ref5[j];
|
||||
r += child.toString(options, level + 1);
|
||||
}
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += '</' + this.name + '>';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
XMLElement.prototype.att = function(name, value) {
|
||||
return this.attribute(name, value);
|
||||
};
|
||||
|
||||
XMLElement.prototype.ins = function(target, value) {
|
||||
return this.instruction(target, value);
|
||||
};
|
||||
|
||||
XMLElement.prototype.a = function(name, value) {
|
||||
return this.attribute(name, value);
|
||||
};
|
||||
|
||||
XMLElement.prototype.i = function(target, value) {
|
||||
return this.instruction(target, value);
|
||||
};
|
||||
|
||||
return XMLElement;
|
||||
|
||||
})(XMLNode);
|
||||
|
||||
}).call(this);
|
||||
331
node_modules/xmlbuilder/lib/XMLNode.js
generated
vendored
Normal file
331
node_modules/xmlbuilder/lib/XMLNode.js
generated
vendored
Normal file
@@ -0,0 +1,331 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLRaw, XMLText, isEmpty, isFunction, isObject,
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
isObject = require('lodash/lang/isObject');
|
||||
|
||||
isFunction = require('lodash/lang/isFunction');
|
||||
|
||||
isEmpty = require('lodash/lang/isEmpty');
|
||||
|
||||
XMLElement = null;
|
||||
|
||||
XMLCData = null;
|
||||
|
||||
XMLComment = null;
|
||||
|
||||
XMLDeclaration = null;
|
||||
|
||||
XMLDocType = null;
|
||||
|
||||
XMLRaw = null;
|
||||
|
||||
XMLText = null;
|
||||
|
||||
module.exports = XMLNode = (function() {
|
||||
function XMLNode(parent) {
|
||||
this.parent = parent;
|
||||
this.options = this.parent.options;
|
||||
this.stringify = this.parent.stringify;
|
||||
if (XMLElement === null) {
|
||||
XMLElement = require('./XMLElement');
|
||||
XMLCData = require('./XMLCData');
|
||||
XMLComment = require('./XMLComment');
|
||||
XMLDeclaration = require('./XMLDeclaration');
|
||||
XMLDocType = require('./XMLDocType');
|
||||
XMLRaw = require('./XMLRaw');
|
||||
XMLText = require('./XMLText');
|
||||
}
|
||||
}
|
||||
|
||||
XMLNode.prototype.element = function(name, attributes, text) {
|
||||
var childNode, item, j, k, key, lastChild, len, len1, ref, val;
|
||||
lastChild = null;
|
||||
if (attributes == null) {
|
||||
attributes = {};
|
||||
}
|
||||
attributes = attributes.valueOf();
|
||||
if (!isObject(attributes)) {
|
||||
ref = [attributes, text], text = ref[0], attributes = ref[1];
|
||||
}
|
||||
if (name != null) {
|
||||
name = name.valueOf();
|
||||
}
|
||||
if (Array.isArray(name)) {
|
||||
for (j = 0, len = name.length; j < len; j++) {
|
||||
item = name[j];
|
||||
lastChild = this.element(item);
|
||||
}
|
||||
} else if (isFunction(name)) {
|
||||
lastChild = this.element(name.apply());
|
||||
} else if (isObject(name)) {
|
||||
for (key in name) {
|
||||
if (!hasProp.call(name, key)) continue;
|
||||
val = name[key];
|
||||
if (isFunction(val)) {
|
||||
val = val.apply();
|
||||
}
|
||||
if ((isObject(val)) && (isEmpty(val))) {
|
||||
val = null;
|
||||
}
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
|
||||
lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && key.indexOf(this.stringify.convertPIKey) === 0) {
|
||||
lastChild = this.instruction(key.substr(this.stringify.convertPIKey.length), val);
|
||||
} else if (Array.isArray(val)) {
|
||||
for (k = 0, len1 = val.length; k < len1; k++) {
|
||||
item = val[k];
|
||||
childNode = {};
|
||||
childNode[key] = item;
|
||||
lastChild = this.element(childNode);
|
||||
}
|
||||
} else if (isObject(val)) {
|
||||
lastChild = this.element(key);
|
||||
lastChild.element(val);
|
||||
} else {
|
||||
lastChild = this.element(key, val);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
|
||||
lastChild = this.text(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
|
||||
lastChild = this.cdata(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
|
||||
lastChild = this.comment(text);
|
||||
} else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
|
||||
lastChild = this.raw(text);
|
||||
} else {
|
||||
lastChild = this.node(name, attributes, text);
|
||||
}
|
||||
}
|
||||
if (lastChild == null) {
|
||||
throw new Error("Could not create any elements with: " + name);
|
||||
}
|
||||
return lastChild;
|
||||
};
|
||||
|
||||
XMLNode.prototype.insertBefore = function(name, attributes, text) {
|
||||
var child, i, removed;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot insert elements at root level");
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i);
|
||||
child = this.parent.element(name, attributes, text);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.insertAfter = function(name, attributes, text) {
|
||||
var child, i, removed;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot insert elements at root level");
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
removed = this.parent.children.splice(i + 1);
|
||||
child = this.parent.element(name, attributes, text);
|
||||
Array.prototype.push.apply(this.parent.children, removed);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.remove = function() {
|
||||
var i, ref;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Cannot remove the root element");
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
[].splice.apply(this.parent.children, [i, i - i + 1].concat(ref = [])), ref;
|
||||
return this.parent;
|
||||
};
|
||||
|
||||
XMLNode.prototype.node = function(name, attributes, text) {
|
||||
var child, ref;
|
||||
if (name != null) {
|
||||
name = name.valueOf();
|
||||
}
|
||||
if (attributes == null) {
|
||||
attributes = {};
|
||||
}
|
||||
attributes = attributes.valueOf();
|
||||
if (!isObject(attributes)) {
|
||||
ref = [attributes, text], text = ref[0], attributes = ref[1];
|
||||
}
|
||||
child = new XMLElement(this, name, attributes);
|
||||
if (text != null) {
|
||||
child.text(text);
|
||||
}
|
||||
this.children.push(child);
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.text = function(value) {
|
||||
var child;
|
||||
child = new XMLText(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.cdata = function(value) {
|
||||
var child;
|
||||
child = new XMLCData(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.comment = function(value) {
|
||||
var child;
|
||||
child = new XMLComment(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.raw = function(value) {
|
||||
var child;
|
||||
child = new XMLRaw(this, value);
|
||||
this.children.push(child);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.declaration = function(version, encoding, standalone) {
|
||||
var doc, xmldec;
|
||||
doc = this.document();
|
||||
xmldec = new XMLDeclaration(doc, version, encoding, standalone);
|
||||
doc.xmldec = xmldec;
|
||||
return doc.root();
|
||||
};
|
||||
|
||||
XMLNode.prototype.doctype = function(pubID, sysID) {
|
||||
var doc, doctype;
|
||||
doc = this.document();
|
||||
doctype = new XMLDocType(doc, pubID, sysID);
|
||||
doc.doctype = doctype;
|
||||
return doctype;
|
||||
};
|
||||
|
||||
XMLNode.prototype.up = function() {
|
||||
if (this.isRoot) {
|
||||
throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
|
||||
}
|
||||
return this.parent;
|
||||
};
|
||||
|
||||
XMLNode.prototype.root = function() {
|
||||
var child;
|
||||
if (this.isRoot) {
|
||||
return this;
|
||||
}
|
||||
child = this.parent;
|
||||
while (!child.isRoot) {
|
||||
child = child.parent;
|
||||
}
|
||||
return child;
|
||||
};
|
||||
|
||||
XMLNode.prototype.document = function() {
|
||||
return this.root().documentObject;
|
||||
};
|
||||
|
||||
XMLNode.prototype.end = function(options) {
|
||||
return this.document().toString(options);
|
||||
};
|
||||
|
||||
XMLNode.prototype.prev = function() {
|
||||
var i;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Root node has no siblings");
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
if (i < 1) {
|
||||
throw new Error("Already at the first node");
|
||||
}
|
||||
return this.parent.children[i - 1];
|
||||
};
|
||||
|
||||
XMLNode.prototype.next = function() {
|
||||
var i;
|
||||
if (this.isRoot) {
|
||||
throw new Error("Root node has no siblings");
|
||||
}
|
||||
i = this.parent.children.indexOf(this);
|
||||
if (i === -1 || i === this.parent.children.length - 1) {
|
||||
throw new Error("Already at the last node");
|
||||
}
|
||||
return this.parent.children[i + 1];
|
||||
};
|
||||
|
||||
XMLNode.prototype.importXMLBuilder = function(xmlbuilder) {
|
||||
var clonedRoot;
|
||||
clonedRoot = xmlbuilder.root().clone();
|
||||
clonedRoot.parent = this;
|
||||
clonedRoot.isRoot = false;
|
||||
this.children.push(clonedRoot);
|
||||
return this;
|
||||
};
|
||||
|
||||
XMLNode.prototype.ele = function(name, attributes, text) {
|
||||
return this.element(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.nod = function(name, attributes, text) {
|
||||
return this.node(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.txt = function(value) {
|
||||
return this.text(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.dat = function(value) {
|
||||
return this.cdata(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.com = function(value) {
|
||||
return this.comment(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.doc = function() {
|
||||
return this.document();
|
||||
};
|
||||
|
||||
XMLNode.prototype.dec = function(version, encoding, standalone) {
|
||||
return this.declaration(version, encoding, standalone);
|
||||
};
|
||||
|
||||
XMLNode.prototype.dtd = function(pubID, sysID) {
|
||||
return this.doctype(pubID, sysID);
|
||||
};
|
||||
|
||||
XMLNode.prototype.e = function(name, attributes, text) {
|
||||
return this.element(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.n = function(name, attributes, text) {
|
||||
return this.node(name, attributes, text);
|
||||
};
|
||||
|
||||
XMLNode.prototype.t = function(value) {
|
||||
return this.text(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.d = function(value) {
|
||||
return this.cdata(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.c = function(value) {
|
||||
return this.comment(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.r = function(value) {
|
||||
return this.raw(value);
|
||||
};
|
||||
|
||||
XMLNode.prototype.u = function() {
|
||||
return this.up();
|
||||
};
|
||||
|
||||
return XMLNode;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
51
node_modules/xmlbuilder/lib/XMLProcessingInstruction.js
generated
vendored
Normal file
51
node_modules/xmlbuilder/lib/XMLProcessingInstruction.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLProcessingInstruction, create;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
module.exports = XMLProcessingInstruction = (function() {
|
||||
function XMLProcessingInstruction(parent, target, value) {
|
||||
this.stringify = parent.stringify;
|
||||
if (target == null) {
|
||||
throw new Error("Missing instruction target");
|
||||
}
|
||||
this.target = this.stringify.insTarget(target);
|
||||
if (value) {
|
||||
this.value = this.stringify.insValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
XMLProcessingInstruction.prototype.clone = function() {
|
||||
return create(XMLProcessingInstruction.prototype, this);
|
||||
};
|
||||
|
||||
XMLProcessingInstruction.prototype.toString = function(options, level) {
|
||||
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += '<?';
|
||||
r += this.target;
|
||||
if (this.value) {
|
||||
r += ' ' + this.value;
|
||||
}
|
||||
r += '?>';
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
return XMLProcessingInstruction;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
49
node_modules/xmlbuilder/lib/XMLRaw.js
generated
vendored
Normal file
49
node_modules/xmlbuilder/lib/XMLRaw.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLNode, XMLRaw, create,
|
||||
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; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
XMLNode = require('./XMLNode');
|
||||
|
||||
module.exports = XMLRaw = (function(superClass) {
|
||||
extend(XMLRaw, superClass);
|
||||
|
||||
function XMLRaw(parent, text) {
|
||||
XMLRaw.__super__.constructor.call(this, parent);
|
||||
if (text == null) {
|
||||
throw new Error("Missing raw text");
|
||||
}
|
||||
this.value = this.stringify.raw(text);
|
||||
}
|
||||
|
||||
XMLRaw.prototype.clone = function() {
|
||||
return create(XMLRaw.prototype, this);
|
||||
};
|
||||
|
||||
XMLRaw.prototype.toString = function(options, level) {
|
||||
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += this.value;
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
return XMLRaw;
|
||||
|
||||
})(XMLNode);
|
||||
|
||||
}).call(this);
|
||||
165
node_modules/xmlbuilder/lib/XMLStringifier.js
generated
vendored
Normal file
165
node_modules/xmlbuilder/lib/XMLStringifier.js
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLStringifier,
|
||||
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
module.exports = XMLStringifier = (function() {
|
||||
function XMLStringifier(options) {
|
||||
this.assertLegalChar = bind(this.assertLegalChar, this);
|
||||
var key, ref, value;
|
||||
this.allowSurrogateChars = options != null ? options.allowSurrogateChars : void 0;
|
||||
ref = (options != null ? options.stringify : void 0) || {};
|
||||
for (key in ref) {
|
||||
if (!hasProp.call(ref, key)) continue;
|
||||
value = ref[key];
|
||||
this[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
XMLStringifier.prototype.eleName = function(val) {
|
||||
val = '' + val || '';
|
||||
return this.assertLegalChar(val);
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.eleText = function(val) {
|
||||
val = '' + val || '';
|
||||
return this.assertLegalChar(this.elEscape(val));
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.cdata = function(val) {
|
||||
val = '' + val || '';
|
||||
if (val.match(/]]>/)) {
|
||||
throw new Error("Invalid CDATA text: " + val);
|
||||
}
|
||||
return this.assertLegalChar(val);
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.comment = function(val) {
|
||||
val = '' + val || '';
|
||||
if (val.match(/--/)) {
|
||||
throw new Error("Comment text cannot contain double-hypen: " + val);
|
||||
}
|
||||
return this.assertLegalChar(val);
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.raw = function(val) {
|
||||
return '' + val || '';
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.attName = function(val) {
|
||||
return '' + val || '';
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.attValue = function(val) {
|
||||
val = '' + val || '';
|
||||
return this.attEscape(val);
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.insTarget = function(val) {
|
||||
return '' + val || '';
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.insValue = function(val) {
|
||||
val = '' + val || '';
|
||||
if (val.match(/\?>/)) {
|
||||
throw new Error("Invalid processing instruction value: " + val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.xmlVersion = function(val) {
|
||||
val = '' + val || '';
|
||||
if (!val.match(/1\.[0-9]+/)) {
|
||||
throw new Error("Invalid version number: " + val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.xmlEncoding = function(val) {
|
||||
val = '' + val || '';
|
||||
if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-]|-)*$/)) {
|
||||
throw new Error("Invalid encoding: " + val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.xmlStandalone = function(val) {
|
||||
if (val) {
|
||||
return "yes";
|
||||
} else {
|
||||
return "no";
|
||||
}
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.dtdPubID = function(val) {
|
||||
return '' + val || '';
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.dtdSysID = function(val) {
|
||||
return '' + val || '';
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.dtdElementValue = function(val) {
|
||||
return '' + val || '';
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.dtdAttType = function(val) {
|
||||
return '' + val || '';
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.dtdAttDefault = function(val) {
|
||||
if (val != null) {
|
||||
return '' + val || '';
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.dtdEntityValue = function(val) {
|
||||
return '' + val || '';
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.dtdNData = function(val) {
|
||||
return '' + val || '';
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.convertAttKey = '@';
|
||||
|
||||
XMLStringifier.prototype.convertPIKey = '?';
|
||||
|
||||
XMLStringifier.prototype.convertTextKey = '#text';
|
||||
|
||||
XMLStringifier.prototype.convertCDataKey = '#cdata';
|
||||
|
||||
XMLStringifier.prototype.convertCommentKey = '#comment';
|
||||
|
||||
XMLStringifier.prototype.convertRawKey = '#raw';
|
||||
|
||||
XMLStringifier.prototype.assertLegalChar = function(str) {
|
||||
var chars, chr;
|
||||
if (this.allowSurrogateChars) {
|
||||
chars = /[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]/;
|
||||
} else {
|
||||
chars = /[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/;
|
||||
}
|
||||
chr = str.match(chars);
|
||||
if (chr) {
|
||||
throw new Error("Invalid character (" + chr + ") in string: " + str + " at index " + chr.index);
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.elEscape = function(str) {
|
||||
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\r/g, '
');
|
||||
};
|
||||
|
||||
XMLStringifier.prototype.attEscape = function(str) {
|
||||
return str.replace(/&/g, '&').replace(/</g, '<').replace(/"/g, '"');
|
||||
};
|
||||
|
||||
return XMLStringifier;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
49
node_modules/xmlbuilder/lib/XMLText.js
generated
vendored
Normal file
49
node_modules/xmlbuilder/lib/XMLText.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLNode, XMLText, create,
|
||||
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; },
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
||||
create = require('lodash/object/create');
|
||||
|
||||
XMLNode = require('./XMLNode');
|
||||
|
||||
module.exports = XMLText = (function(superClass) {
|
||||
extend(XMLText, superClass);
|
||||
|
||||
function XMLText(parent, text) {
|
||||
XMLText.__super__.constructor.call(this, parent);
|
||||
if (text == null) {
|
||||
throw new Error("Missing element text");
|
||||
}
|
||||
this.value = this.stringify.eleText(text);
|
||||
}
|
||||
|
||||
XMLText.prototype.clone = function() {
|
||||
return create(XMLText.prototype, this);
|
||||
};
|
||||
|
||||
XMLText.prototype.toString = function(options, level) {
|
||||
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
|
||||
pretty = (options != null ? options.pretty : void 0) || false;
|
||||
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
|
||||
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
|
||||
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
|
||||
level || (level = 0);
|
||||
space = new Array(level + offset + 1).join(indent);
|
||||
r = '';
|
||||
if (pretty) {
|
||||
r += space;
|
||||
}
|
||||
r += this.value;
|
||||
if (pretty) {
|
||||
r += newline;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
return XMLText;
|
||||
|
||||
})(XMLNode);
|
||||
|
||||
}).call(this);
|
||||
14
node_modules/xmlbuilder/lib/index.js
generated
vendored
Normal file
14
node_modules/xmlbuilder/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// Generated by CoffeeScript 1.9.1
|
||||
(function() {
|
||||
var XMLBuilder, assign;
|
||||
|
||||
assign = require('lodash/object/assign');
|
||||
|
||||
XMLBuilder = require('./XMLBuilder');
|
||||
|
||||
module.exports.create = function(name, xmldec, doctype, options) {
|
||||
options = assign({}, xmldec, doctype, options);
|
||||
return new XMLBuilder(name, options).root();
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
Reference in New Issue
Block a user