Comparing version 0.1.14 to 0.2.0
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.3.1 | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
var events, isEmpty, sax, | ||
__hasProp = {}.hasOwnProperty, | ||
__extends = 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; }, | ||
__extends = 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; }, | ||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; | ||
@@ -47,4 +47,2 @@ | ||
ValidationError.name = 'ValidationError'; | ||
function ValidationError(message) { | ||
@@ -62,4 +60,2 @@ this.message = message; | ||
Parser.name = 'Parser'; | ||
function Parser(opts) { | ||
@@ -72,3 +68,3 @@ this.parseString = __bind(this.parseString, this); | ||
this.options = {}; | ||
_ref = exports.defaults["0.1"]; | ||
_ref = exports.defaults["0.2"]; | ||
for (key in _ref) { | ||
@@ -75,0 +71,0 @@ if (!__hasProp.call(_ref, key)) continue; |
@@ -6,3 +6,3 @@ { | ||
"homepage" : "https://github.com/Leonidas-from-XIV/node-xml2js", | ||
"version" : "0.1.14", | ||
"version" : "0.2.0", | ||
"author" : "Marek Kubica <marek@xivilization.net> (http://xivilization.net)", | ||
@@ -37,5 +37,5 @@ "contributors" : [ | ||
"coffee-script" : ">=1.0.1", | ||
"zap" : ">=0.2.3", | ||
"zap" : ">=0.2.4-2", | ||
"docco" : ">=0.3.0" | ||
} | ||
} |
@@ -115,10 +115,10 @@ node-xml2js | ||
* `explicitCharkey` (default: `false`) | ||
* `trim` (default: `true`): Trim the whitespace at the beginning and end of | ||
* `trim` (default: `false`): Trim the whitespace at the beginning and end of | ||
text nodes. | ||
* `normalize` (default: `true`): Trim whitespaces inside text nodes. | ||
* `explicitRoot` (default: `false`): Set this if you want to get the root | ||
* `normalize` (default: `false`): Trim whitespaces inside text nodes. | ||
* `explicitRoot` (default: `true`): Set this if you want to get the root | ||
node in the resulting object. | ||
* `emptyTag` (default: `undefined`): what will the value of empty nodes be. | ||
Default is `{}`. | ||
* `explicitArray` (default: `false`): Always put child nodes in an array if | ||
* `explicitArray` (default: `true`): Always put child nodes in an array if | ||
true; otherwise an array is created only if there is more than one. | ||
@@ -134,6 +134,34 @@ * `ignoreAttrs` (default: `false`): Ignore all XML attributes and only create | ||
These default settings are for backward-compatibility (and might change in the | ||
future). For the most 'clean' parsing, you should disable `normalize` and | ||
`trimming` and enable `explicitRoot`. | ||
These default settings are for backward-compatibility. These are scheduled to | ||
change to a more 'clean' way of parsing in version 0.2. | ||
Updating to new version | ||
======================= | ||
As version 0.2 will change the default parsing settings version 0.1.14 | ||
introduced the default settings for version 0.2. | ||
```javascript | ||
var xml2js = require('xml2js'); | ||
var parser = new xml2js.Parser(xml2js.defaults["0.2"]); | ||
``` | ||
To get the 0.1 defaults in version 0.2 you can just use | ||
`xml2js.defaults["0.1"]` in the same place. This provides you with enough time | ||
to migrate to the saner way of parsing in xml2js 0.2. We try to make the | ||
migration as simple and gentle as possible, but some breakage cannot be | ||
avoided. | ||
So, what exactly did change and why? In 0.2 we changed some defaults to parse | ||
the XML in a more universal and sane way. So we disabled `normalize` and `trim` | ||
so xml2js does not cut out any text content. You can reenable this at will of | ||
course. A more important change is that we return the root tag in the resulting | ||
JavaScript structure via the `explicitRoot` setting, so you need to access the | ||
first element. This is useful for anybody who wants to know what the root node | ||
is and preserves more information. The last major change was to enable | ||
`explicitArray`, so everytime it is possible that one might embed more than one | ||
sub-tag into a tag, xml2js >= 0.2 returns an array even if the array just | ||
includes one element. This is useful when dealing with APIs that return | ||
variable amounts of subtags. | ||
Running tests, development | ||
@@ -140,0 +168,0 @@ ========================== |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
31149
171
202