Adds an Argument
object the passed in elementtree object.
Adds an
Adds an Argument
object the passed in elementtree object.
Adds an
Name | Type | Description |
---|---|---|
parent | Object | An elementtree element object to be the parent of a new |
An elementtree element object representing this argument.
Argument.prototype.addToDocument = function (parent) {
var arg = ET.SubElement(parent, "arg");
arg.set("name", this.name);
if (this.description) {
ET.SubElement(arg, "description").text = this.description;
}
if (this.validation) {
ET.SubElement(arg, "validation").text = this.validation;
}
// Add all other subelements to this <arg>, represented by (tag, text)
var subElements = [
{tag: "data_type", value: this.dataType},
{tag: "required_on_edit", value: this.requiredOnEdit},
{tag: "required_on_create", value: this.requiredOnCreate}
];
for (var i = 0; i < subElements.length; i++) {
ET.SubElement(arg, subElements[i].tag).text = subElements[i].value.toString().toLowerCase();
}
return arg;
};
module.exports = Argument;
})();