artdaq_node_server  v1_00_07
 All Classes Namespaces Files Variables Pages
XMLDTDNotation.js
1 // Generated by CoffeeScript 1.9.1
2 (function() {
3  var XMLDTDNotation, create;
4 
5  create = require('lodash/create');
6 
7  module.exports = XMLDTDNotation = (function() {
8  function XMLDTDNotation(parent, name, value) {
9  this.stringify = parent.stringify;
10  if (name == null) {
11  throw new Error("Missing notation name");
12  }
13  if (!value.pubID && !value.sysID) {
14  throw new Error("Public or system identifiers are required for an external entity");
15  }
16  this.name = this.stringify.eleName(name);
17  if (value.pubID != null) {
18  this.pubID = this.stringify.dtdPubID(value.pubID);
19  }
20  if (value.sysID != null) {
21  this.sysID = this.stringify.dtdSysID(value.sysID);
22  }
23  }
24 
25  XMLDTDNotation.prototype.toString = function(options, level) {
26  var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
27  pretty = (options != null ? options.pretty : void 0) || false;
28  indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
29  offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
30  newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
31  level || (level = 0);
32  space = new Array(level + offset + 1).join(indent);
33  r = '';
34  if (pretty) {
35  r += space;
36  }
37  r += '<!NOTATION ' + this.name;
38  if (this.pubID && this.sysID) {
39  r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"';
40  } else if (this.pubID) {
41  r += ' PUBLIC "' + this.pubID + '"';
42  } else if (this.sysID) {
43  r += ' SYSTEM "' + this.sysID + '"';
44  }
45  r += '>';
46  if (pretty) {
47  r += newline;
48  }
49  return r;
50  };
51 
52  return XMLDTDNotation;
53 
54  })();
55 
56 }).call(this);