3 var XMLDTDNotation, create;
5 create = require(
'lodash/create');
7 module.exports = XMLDTDNotation = (
function() {
8 function XMLDTDNotation(parent, name, value) {
9 this.stringify = parent.stringify;
11 throw new Error(
"Missing notation name");
13 if (!value.pubID && !value.sysID) {
14 throw new Error(
"Public or system identifiers are required for an external entity");
16 this.name = this.stringify.eleName(name);
17 if (value.pubID != null) {
18 this.pubID = this.stringify.dtdPubID(value.pubID);
20 if (value.sysID != null) {
21 this.sysID = this.stringify.dtdSysID(value.sysID);
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';
32 space =
new Array(level + offset + 1).join(indent);
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 +
'"';
52 return XMLDTDNotation;