3 var XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNode, isObject,
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;
7 isObject = require(
'./Utility').isObject;
9 XMLNode = require(
'./XMLNode');
11 XMLDTDAttList = require(
'./XMLDTDAttList');
13 XMLDTDEntity = require(
'./XMLDTDEntity');
15 XMLDTDElement = require(
'./XMLDTDElement');
17 XMLDTDNotation = require(
'./XMLDTDNotation');
19 module.exports = XMLDocType = (
function(superClass) {
20 extend(XMLDocType, superClass);
22 function XMLDocType(parent, pubID, sysID) {
24 XMLDocType.__super__.constructor.call(
this, parent);
25 this.documentObject = parent;
26 if (isObject(pubID)) {
27 ref = pubID, pubID = ref.pubID, sysID = ref.sysID;
30 ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1];
33 this.pubID = this.stringify.dtdPubID(pubID);
36 this.sysID = this.stringify.dtdSysID(sysID);
40 XMLDocType.prototype.element =
function(name, value) {
42 child =
new XMLDTDElement(
this, name, value);
43 this.children.push(child);
47 XMLDocType.prototype.attList =
function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
49 child =
new XMLDTDAttList(
this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
50 this.children.push(child);
54 XMLDocType.prototype.entity =
function(name, value) {
56 child =
new XMLDTDEntity(
this,
false, name, value);
57 this.children.push(child);
61 XMLDocType.prototype.pEntity =
function(name, value) {
63 child =
new XMLDTDEntity(
this,
true, name, value);
64 this.children.push(child);
68 XMLDocType.prototype.notation =
function(name, value) {
70 child =
new XMLDTDNotation(
this, name, value);
71 this.children.push(child);
75 XMLDocType.prototype.toString =
function(options) {
76 return this.options.writer.set(options).docType(
this);
79 XMLDocType.prototype.ele =
function(name, value) {
80 return this.element(name, value);
83 XMLDocType.prototype.att =
function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
84 return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
87 XMLDocType.prototype.ent =
function(name, value) {
88 return this.entity(name, value);
91 XMLDocType.prototype.pent =
function(name, value) {
92 return this.pEntity(name, value);
95 XMLDocType.prototype.not =
function(name, value) {
96 return this.notation(name, value);
99 XMLDocType.prototype.up =
function() {
100 return this.root() || this.documentObject;