Add the provided argument, arg
, to the this.arguments
Array.
Add the provided argument, arg
, to the this.arguments
Array.
Name | Type | Description |
---|---|---|
arg | Object | An Argument object to add to this Scheme's argument list. |
Scheme.prototype.addArgument = function (arg) {
if (arg) {
this.args.push(arg);
}
};
Creates an elementtree Element representing this Scheme, then returns it.
An elementtree Element object representing this Scheme.
Scheme.prototype.toXML = function () {
var root = ET.Element("scheme");
ET.SubElement(root, "title").text = this.title;
if (this.description) {
ET.SubElement(root, "description").text = this.description;
}
// Add all subelements to this <scheme>, represented by (tag, text).
var subElements = [
{tag: "use_external_validation", value: this.useExternalValidation},
{tag: "use_single_instance", value: this.useSingleInstance},
{tag: "streaming_mode", value: this.streamingMode}
];
for (var i = 0; i < subElements.length; i++) {
ET.SubElement(root, subElements[i].tag).text = subElements[i].value.toString().toLowerCase();
}
// Create an <endpoint> subelement in root, then an <args> subelement in endpoint.
var argsElement = ET.SubElement(ET.SubElement(root, "endpoint"), "args");
// Add arguments as subelements to <args>.
for (var j = 0; j < this.args.length; j++) {
this.args[j].addToDocument(argsElement);
}
return root;
};
module.exports = Scheme;
})();