xmlbuilder
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -12,3 +12,3 @@ (function() { | ||
XMLFragment = require('./XMLFragment'); | ||
XMLBuilder = function() { | ||
XMLBuilder = (function() { | ||
__extends(XMLBuilder, XMLFragment); | ||
@@ -18,3 +18,3 @@ function XMLBuilder() { | ||
} | ||
XMLBuilder.prototype.begin = function(name, xmldec, doctype) { | ||
XMLBuilder.prototype.begin = function(name, xmldec, doctype, options) { | ||
var att, child, root; | ||
@@ -81,4 +81,4 @@ if (!name) { | ||
return XMLBuilder; | ||
}(); | ||
})(); | ||
module.exports = XMLBuilder; | ||
}).call(this); |
(function() { | ||
var XMLFragment; | ||
XMLFragment = function() { | ||
XMLFragment = (function() { | ||
function XMLFragment(parent, name, attributes, text) { | ||
@@ -34,3 +34,3 @@ this.parent = parent; | ||
} | ||
if (!String(value).match("^" + this.val.EntityValue + "$") && !String(value).match(this.val.CDATA)) { | ||
if (!String(value).match("^" + this.val.CharData + "$") && !String(value).match(this.val.CDATA)) { | ||
throw new Error("Invalid element text: " + value); | ||
@@ -42,2 +42,17 @@ } | ||
}; | ||
XMLFragment.prototype.comment = function(value) { | ||
var child; | ||
if (this.value) { | ||
throw new Error("Text nodes cannot have child nodes"); | ||
} | ||
if (!(value != null)) { | ||
throw new Error("Missing comment text"); | ||
} | ||
if (!String(value).match("^" + this.val.CommentContent + "$")) { | ||
throw new Error("Invalid comment text: " + value); | ||
} | ||
child = new XMLFragment(this, '', {}, '<!-- ' + value + ' -->'); | ||
this.children.push(child); | ||
return this; | ||
}; | ||
XMLFragment.prototype.up = function() { | ||
@@ -129,2 +144,5 @@ if (!(this.parent != null)) { | ||
}; | ||
XMLFragment.prototype.com = function(name, value) { | ||
return this.comment(name, value); | ||
}; | ||
XMLFragment.prototype.e = function(name, attributes) { | ||
@@ -139,2 +157,5 @@ return this.element(name, attributes); | ||
}; | ||
XMLFragment.prototype.c = function(name, value) { | ||
return this.comment(name, value); | ||
}; | ||
XMLFragment.prototype.u = function() { | ||
@@ -144,3 +165,3 @@ return this.up; | ||
return XMLFragment; | ||
}(); | ||
})(); | ||
XMLFragment.prototype.val = {}; | ||
@@ -164,3 +185,4 @@ XMLFragment.prototype.val.Space = "(?:\u0020|\u0009|\u000D|\u000A)+"; | ||
XMLFragment.prototype.val.CommentChar = '(?!-)' + '(?:' + XMLFragment.prototype.val.Char + ')'; | ||
XMLFragment.prototype.val.Comment = '<!--' + '(?:' + XMLFragment.prototype.val.CommentChar + '|' + '-' + XMLFragment.prototype.val.CommentChar + ')*' + '-->'; | ||
XMLFragment.prototype.val.CommentContent = '(?:' + XMLFragment.prototype.val.CommentChar + '|' + '-' + XMLFragment.prototype.val.CommentChar + ')*'; | ||
XMLFragment.prototype.val.Comment = '<!--' + XMLFragment.prototype.val.CommentContent + '-->'; | ||
XMLFragment.prototype.val.VersionNum = '1\.[0-9]+'; | ||
@@ -167,0 +189,0 @@ XMLFragment.prototype.val.EncName = '[A-Za-z](?:[A-Za-z0-9\._]|-)*'; |
{ | ||
"name" : "xmlbuilder", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "An XML builder for node.js", | ||
@@ -5,0 +5,0 @@ "author": "Ozgur Ozcitak <oozcitak@gmail.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
11407
275
0