artdaq_node_server  v1_00_08
 All Classes Namespaces Files Variables Pages
XMLDTDElement.js
1 // Generated by CoffeeScript 1.9.1
2 (function() {
3  var XMLDTDElement, create;
4 
5  create = require('lodash/create');
6 
7  module.exports = XMLDTDElement = (function() {
8  function XMLDTDElement(parent, name, value) {
9  this.stringify = parent.stringify;
10  if (name == null) {
11  throw new Error("Missing DTD element name");
12  }
13  if (!value) {
14  value = '(#PCDATA)';
15  }
16  if (Array.isArray(value)) {
17  value = '(' + value.join(',') + ')';
18  }
19  this.name = this.stringify.eleName(name);
20  this.value = this.stringify.dtdElementValue(value);
21  }
22 
23  XMLDTDElement.prototype.toString = function(options, level) {
24  var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
25  pretty = (options != null ? options.pretty : void 0) || false;
26  indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
27  offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
28  newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
29  level || (level = 0);
30  space = new Array(level + offset + 1).join(indent);
31  r = '';
32  if (pretty) {
33  r += space;
34  }
35  r += '<!ELEMENT ' + this.name + ' ' + this.value + '>';
36  if (pretty) {
37  r += newline;
38  }
39  return r;
40  };
41 
42  return XMLDTDElement;
43 
44  })();
45 
46 }).call(this);