00001
00002 (function() {
00003 var XMLDTDElement, XMLNode,
00004 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; },
00005 hasProp = {}.hasOwnProperty;
00006
00007 XMLNode = require('./XMLNode');
00008
00009 module.exports = XMLDTDElement = (function(superClass) {
00010 extend(XMLDTDElement, superClass);
00011
00012 function XMLDTDElement(parent, name, value) {
00013 XMLDTDElement.__super__.constructor.call(this, parent);
00014 if (name == null) {
00015 throw new Error("Missing DTD element name");
00016 }
00017 if (!value) {
00018 value = '(#PCDATA)';
00019 }
00020 if (Array.isArray(value)) {
00021 value = '(' + value.join(',') + ')';
00022 }
00023 this.name = this.stringify.eleName(name);
00024 this.value = this.stringify.dtdElementValue(value);
00025 }
00026
00027 XMLDTDElement.prototype.toString = function(options) {
00028 return this.options.writer.set(options).dtdElement(this);
00029 };
00030
00031 return XMLDTDElement;
00032
00033 })(XMLNode);
00034
00035 }).call(this);