blob: 8f911c257dd82ba1bec3d8ee34775a3f6be25356 [file] [log] [blame]
// Generated by CoffeeScript 1.12.7
(function() {
var XMLDTDAttList, XMLNode,
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; },
hasProp = {}.hasOwnProperty;
XMLNode = require('./XMLNode');
module.exports = XMLDTDAttList = (function(superClass) {
extend(XMLDTDAttList, superClass);
function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
XMLDTDAttList.__super__.constructor.call(this, parent);
if (elementName == null) {
throw new Error("Missing DTD element name");
}
if (attributeName == null) {
throw new Error("Missing DTD attribute name");
}
if (!attributeType) {
throw new Error("Missing DTD attribute type");
}
if (!defaultValueType) {
throw new Error("Missing DTD attribute default");
}
if (defaultValueType.indexOf('#') !== 0) {
defaultValueType = '#' + defaultValueType;
}
if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");
}
if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
throw new Error("Default value only applies to #FIXED or #DEFAULT");
}
this.elementName = this.stringify.eleName(elementName);
this.attributeName = this.stringify.attName(attributeName);
this.attributeType = this.stringify.dtdAttType(attributeType);
this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
this.defaultValueType = defaultValueType;
}
XMLDTDAttList.prototype.toString = function(options) {
return this.options.writer.set(options).dtdAttList(this);
};
return XMLDTDAttList;
})(XMLNode);
}).call(this);