artdaq_node_server  v1_00_08
 All Classes Namespaces Files Variables Pages
XMLDTDAttList.js
1 // Generated by CoffeeScript 1.10.0
2 (function() {
3  var XMLDTDAttList, 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 = XMLDTDAttList = (function(superClass) {
10  extend(XMLDTDAttList, superClass);
11 
12  function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
13  XMLDTDAttList.__super__.constructor.call(this, parent);
14  if (elementName == null) {
15  throw new Error("Missing DTD element name");
16  }
17  if (attributeName == null) {
18  throw new Error("Missing DTD attribute name");
19  }
20  if (!attributeType) {
21  throw new Error("Missing DTD attribute type");
22  }
23  if (!defaultValueType) {
24  throw new Error("Missing DTD attribute default");
25  }
26  if (defaultValueType.indexOf('#') !== 0) {
27  defaultValueType = '#' + defaultValueType;
28  }
29  if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
30  throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");
31  }
32  if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
33  throw new Error("Default value only applies to #FIXED or #DEFAULT");
34  }
35  this.elementName = this.stringify.eleName(elementName);
36  this.attributeName = this.stringify.attName(attributeName);
37  this.attributeType = this.stringify.dtdAttType(attributeType);
38  this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
39  this.defaultValueType = defaultValueType;
40  }
41 
42  XMLDTDAttList.prototype.toString = function(options) {
43  return this.options.writer.set(options).dtdAttList(this);
44  };
45 
46  return XMLDTDAttList;
47 
48  })(XMLNode);
49 
50 }).call(this);