Comparing version 0.4.16 to 0.4.17
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
"use strict"; | ||
var xml2js; | ||
xml2js = require('../lib/xml2js'); | ||
exports.stripBOM = function(str) { | ||
@@ -9,0 +5,0 @@ if (str[0] === '\uFEFF') { |
@@ -65,2 +65,3 @@ // Generated by CoffeeScript 1.10.0 | ||
charsAsChildren: false, | ||
includeWhiteChars: false, | ||
async: false, | ||
@@ -91,2 +92,3 @@ strict: true, | ||
charsAsChildren: false, | ||
includeWhiteChars: false, | ||
async: false, | ||
@@ -457,3 +459,3 @@ strict: true, | ||
s[charkey] += text; | ||
if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && text.replace(/\\n/g, '').trim() !== '') { | ||
if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) { | ||
s[_this.options.childkey] = s[_this.options.childkey] || []; | ||
@@ -464,2 +466,5 @@ charChild = { | ||
charChild[charkey] = text; | ||
if (_this.options.normalize) { | ||
charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim(); | ||
} | ||
s[_this.options.childkey].push(charChild); | ||
@@ -466,0 +471,0 @@ } |
@@ -9,3 +9,3 @@ { | ||
"homepage": "https://github.com/Leonidas-from-XIV/node-xml2js", | ||
"version": "0.4.16", | ||
"version": "0.4.17", | ||
"author": "Marek Kubica <marek@xivilization.net> (https://xivilization.net)", | ||
@@ -54,3 +54,4 @@ "contributors": [ | ||
"Bogdan Chadkin <trysound@yandex.ru> (https://github.com/TrySound)", | ||
"David Wood <david.p.wood@gmail.com> (http://codesleuth.co.uk/)" | ||
"David Wood <david.p.wood@gmail.com> (http://codesleuth.co.uk/)", | ||
"Nicolas Maquet (https://github.com/nmaquet)" | ||
], | ||
@@ -57,0 +58,0 @@ "main": "./lib/xml2js", |
@@ -87,3 +87,3 @@ node-xml2js | ||
You can also use `xml2js` from | ||
[CoffeeScript](http://jashkenas.github.com/coffee-script/), further reducing | ||
[CoffeeScript](https://github.com/jashkenas/coffeescript), further reducing | ||
the clutter: | ||
@@ -108,22 +108,5 @@ | ||
"Traditional" usage | ||
------------------- | ||
Parsing multiple files | ||
---------------------- | ||
Alternatively you can still use the traditional `addListener` variant that was | ||
supported since forever: | ||
```javascript | ||
var fs = require('fs'), | ||
xml2js = require('xml2js'); | ||
var parser = new xml2js.Parser(); | ||
parser.addListener('end', function(result) { | ||
console.dir(result); | ||
console.log('Done.'); | ||
}); | ||
fs.readFile(__dirname + '/foo.xml', function(err, data) { | ||
parser.parseString(data); | ||
}); | ||
``` | ||
If you want to parse multiple files, you have multiple possibilities: | ||
@@ -278,2 +261,4 @@ | ||
considered children if `explicitChildren` is on. Added in 0.2.5. | ||
* `includeWhiteChars` (default `false`): Determines whether whitespace-only | ||
text nodes should be included. Added in 0.4.17. | ||
* `async` (default `false`): Should the callbacks be async? This *might* be | ||
@@ -280,0 +265,0 @@ an incompatible change if your code depends on sync execution of callbacks. |
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
550
39217
396