artdaq_node_server  v1_00_07
 All Classes Namespaces Files Variables Pages
XMLDTDElement.js
1 // Generated by CoffeeScript 1.10.0
2 (function() {
3  var XMLDTDElement, XMLNode,
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;
6 
7  XMLNode = require('./XMLNode');
8 
9  module.exports = XMLDTDElement = (function(superClass) {
10  extend(XMLDTDElement, superClass);
11 
12  function XMLDTDElement(parent, name, value) {
13  XMLDTDElement.__super__.constructor.call(this, parent);
14  if (name == null) {
15  throw new Error("Missing DTD element name");
16  }
17  if (!value) {
18  value = '(#PCDATA)';
19  }
20  if (Array.isArray(value)) {
21  value = '(' + value.join(',') + ')';
22  }
23  this.name = this.stringify.eleName(name);
24  this.value = this.stringify.dtdElementValue(value);
25  }
26 
27  XMLDTDElement.prototype.toString = function(options) {
28  return this.options.writer.set(options).dtdElement(this);
29  };
30 
31  return XMLDTDElement;
32 
33  })(XMLNode);
34 
35 }).call(this);