xmlbuilder
Advanced tools
Comparing version 10.0.0 to 10.1.0
@@ -5,4 +5,10 @@ # Change Log | ||
## [10.0.0] - 2018-04-26 | ||
- Added current indentation level as a parameter to the onData function when in callback mode. See [#125](https://github.com/oozcitak/xmlbuilder-js/issues/125). | ||
- Added name of the current node and parent node to error messages where possible. See [#152](https://github.com/oozcitak/xmlbuilder-js/issues/152). This has the potential to break code depending on the content of error messages. | ||
- Fixed an issue where objects created with Object.create(null) created an error. See [#176](https://github.com/oozcitak/xmlbuilder-js/issues/176). | ||
- Added test builds for node.js v8 and v10. | ||
## [9.0.7] - 2018-02-09 | ||
- simplified regex used for validating encoding. | ||
- Simplified regex used for validating encoding. | ||
@@ -352,2 +358,3 @@ ## [9.0.4] - 2017-08-16 | ||
[10.0.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v9.0.7...v10.0.0 | ||
[9.0.7]: https://github.com/oozcitak/xmlbuilder-js/compare/v9.0.4...v9.0.7 | ||
@@ -354,0 +361,0 @@ [9.0.4]: https://github.com/oozcitak/xmlbuilder-js/compare/v9.0.3...v9.0.4 |
@@ -29,10 +29,5 @@ // Generated by CoffeeScript 1.12.7 | ||
XMLAttribute.prototype.debugInfo = function(name) { | ||
var ref, ref1; | ||
name = name || this.name; | ||
if ((name == null) && !((ref = this.parent) != null ? ref.name : void 0)) { | ||
return ""; | ||
} else if (name == null) { | ||
if (name == null) { | ||
return "parent: <" + this.parent.name + ">"; | ||
} else if (!((ref1 = this.parent) != null ? ref1.name : void 0)) { | ||
return "attribute: {" + name + "}"; | ||
} else { | ||
@@ -39,0 +34,0 @@ return "attribute: {" + name + "}, parent: <" + this.parent.name + ">"; |
@@ -63,3 +63,3 @@ // Generated by CoffeeScript 1.12.7 | ||
XMLDocumentCB.prototype.node = function(name, attributes, text) { | ||
var ref1; | ||
var ref1, ref2; | ||
if (name == null) { | ||
@@ -73,2 +73,5 @@ throw new Error("Missing node name."); | ||
name = getValue(name); | ||
if (attributes === null && (text == null)) { | ||
ref1 = [{}, null], attributes = ref1[0], text = ref1[1]; | ||
} | ||
if (attributes == null) { | ||
@@ -79,3 +82,3 @@ attributes = {}; | ||
if (!isObject(attributes)) { | ||
ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; | ||
ref2 = [attributes, text], text = ref2[0], attributes = ref2[1]; | ||
} | ||
@@ -82,0 +85,0 @@ this.currentNode = new XMLElement(this, name, attributes); |
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref, | ||
var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNode, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref, | ||
hasProp = {}.hasOwnProperty; | ||
@@ -24,2 +24,4 @@ | ||
XMLDummy = null; | ||
module.exports = XMLNode = (function() { | ||
@@ -42,2 +44,3 @@ function XMLNode(parent) { | ||
XMLProcessingInstruction = require('./XMLProcessingInstruction'); | ||
XMLDummy = require('./XMLDummy'); | ||
} | ||
@@ -47,4 +50,7 @@ } | ||
XMLNode.prototype.element = function(name, attributes, text) { | ||
var childNode, item, j, k, key, lastChild, len, len1, ref1, val; | ||
var childNode, item, j, k, key, lastChild, len, len1, ref1, ref2, val; | ||
lastChild = null; | ||
if (attributes === null && (text == null)) { | ||
ref1 = [{}, null], attributes = ref1[0], text = ref1[1]; | ||
} | ||
if (attributes == null) { | ||
@@ -55,3 +61,3 @@ attributes = {}; | ||
if (!isObject(attributes)) { | ||
ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; | ||
ref2 = [attributes, text], text = ref2[0], attributes = ref2[1]; | ||
} | ||
@@ -94,2 +100,4 @@ if (name != null) { | ||
} | ||
} else if (this.options.skipNullNodes && text === null) { | ||
lastChild = this.dummy(); | ||
} else { | ||
@@ -214,2 +222,9 @@ if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) { | ||
XMLNode.prototype.dummy = function() { | ||
var child; | ||
child = new XMLDummy(this); | ||
this.children.push(child); | ||
return child; | ||
}; | ||
XMLNode.prototype.instruction = function(target, value) { | ||
@@ -338,2 +353,5 @@ var insTarget, insValue, instruction, j, len; | ||
i = this.parent.children.indexOf(this); | ||
while (i > 0 && this.parent.children[i - 1].isDummy) { | ||
i = i - 1; | ||
} | ||
if (i < 1) { | ||
@@ -348,2 +366,5 @@ throw new Error("Already at the first node. " + this.debugInfo()); | ||
i = this.parent.children.indexOf(this); | ||
while (i < this.parent.children.length - 1 && this.parent.children[i + 1].isDummy) { | ||
i = i + 1; | ||
} | ||
if (i === -1 || i === this.parent.children.length - 1) { | ||
@@ -350,0 +371,0 @@ throw new Error("Already at the last node. " + this.debugInfo()); |
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStreamWriter, XMLText, XMLWriterBase, | ||
var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStreamWriter, XMLText, XMLWriterBase, | ||
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; }, | ||
@@ -23,2 +23,4 @@ hasProp = {}.hasOwnProperty; | ||
XMLDummy = require('./XMLDummy'); | ||
XMLDTDAttList = require('./XMLDTDAttList'); | ||
@@ -194,2 +196,5 @@ | ||
break; | ||
case !(child instanceof XMLDummy): | ||
''; | ||
break; | ||
default: | ||
@@ -196,0 +201,0 @@ throw new Error("Unknown XML node type: " + child.constructor.name); |
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLText, XMLWriterBase, | ||
var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLText, XMLWriterBase, | ||
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; }, | ||
@@ -23,2 +23,4 @@ hasProp = {}.hasOwnProperty; | ||
XMLDummy = require('./XMLDummy'); | ||
XMLDTDAttList = require('./XMLDTDAttList'); | ||
@@ -207,2 +209,4 @@ | ||
return this.processingInstruction(child, level + 1); | ||
case !(child instanceof XMLDummy): | ||
return ''; | ||
default: | ||
@@ -209,0 +213,0 @@ throw new Error("Unknown XML node type: " + child.constructor.name); |
{ | ||
"name": "xmlbuilder", | ||
"version": "10.0.0", | ||
"version": "10.1.0", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "xml", |
@@ -10,3 +10,4 @@ # xmlbuilder-js | ||
[![Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js) | ||
[![Travis Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js) | ||
[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/bf7odb20hj77isry?svg=true)](https://ci.appveyor.com/project/oozcitak/xmlbuilder-js) | ||
[![Dev Dependency Status](http://img.shields.io/david/dev/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js) | ||
@@ -13,0 +14,0 @@ [![Code Coverage](https://img.shields.io/coveralls/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://coveralls.io/github/oozcitak/xmlbuilder-js) |
109828
28
2220
87