@brickhouse-tech/xml2js 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright 2010, 2011, 2012, 2013. All rights reserved.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,516 @@
1
+ node-xml2js
2
+ ===========
3
+
4
+ > **⚠️ LTS Security Fork** — This is a community-maintained fork by [Brickhouse Tech](https://github.com/brickhouse-tech) providing security patches for `xml2js`. The upstream repository is inactive with unpatched CVEs affecting 29M+ weekly downloads.
5
+ >
6
+ > **Patches included:**
7
+ > - ✅ CVE-2023-0842 — Prototype pollution via parsed XML (fixed in upstream 0.6.2, regression tests added here)
8
+ >
9
+ > **Support this work:** [GitHub Sponsors](https://github.com/sponsors/brickhouse-tech)
10
+
11
+ ---
12
+
13
+ Ever had the urge to parse XML? And wanted to access the data in some sane,
14
+ easy way? Don't want to compile a C parser, for whatever reason? Then xml2js is
15
+ what you're looking for!
16
+
17
+ Description
18
+ ===========
19
+
20
+ Simple XML to JavaScript object converter. It supports bi-directional conversion.
21
+ Uses [sax-js](https://github.com/isaacs/sax-js/) and
22
+ [xmlbuilder-js](https://github.com/oozcitak/xmlbuilder-js/).
23
+
24
+ Note: If you're looking for a full DOM parser, you probably want
25
+ [JSDom](https://github.com/tmpvar/jsdom).
26
+
27
+ Installation
28
+ ============
29
+
30
+ Simplest way to install `xml2js` is to use [npm](http://npmjs.org), just `npm
31
+ install xml2js` which will download xml2js and all dependencies.
32
+
33
+ xml2js is also available via [Bower](http://bower.io/), just `bower install
34
+ xml2js` which will download xml2js and all dependencies.
35
+
36
+ Usage
37
+ =====
38
+
39
+ No extensive tutorials required because you are a smart developer! The task of
40
+ parsing XML should be an easy one, so let's make it so! Here's some examples.
41
+
42
+ Shoot-and-forget usage
43
+ ----------------------
44
+
45
+ You want to parse XML as simple and easy as possible? It's dangerous to go
46
+ alone, take this:
47
+
48
+ ```javascript
49
+ var parseString = require('xml2js').parseString;
50
+ var xml = "<root>Hello xml2js!</root>"
51
+ parseString(xml, function (err, result) {
52
+ console.dir(result);
53
+ });
54
+ ```
55
+
56
+ Can't get easier than this, right? This works starting with `xml2js` 0.2.3.
57
+ With CoffeeScript it looks like this:
58
+
59
+ ```coffeescript
60
+ {parseString} = require 'xml2js'
61
+ xml = "<root>Hello xml2js!</root>"
62
+ parseString xml, (err, result) ->
63
+ console.dir result
64
+ ```
65
+
66
+ If you need some special options, fear not, `xml2js` supports a number of
67
+ options (see below), you can specify these as second argument:
68
+
69
+ ```javascript
70
+ parseString(xml, {trim: true}, function (err, result) {
71
+ });
72
+ ```
73
+
74
+ Simple as pie usage
75
+ -------------------
76
+
77
+ That's right, if you have been using xml-simple or a home-grown
78
+ wrapper, this was added in 0.1.11 just for you:
79
+
80
+ ```javascript
81
+ var fs = require('fs'),
82
+ xml2js = require('xml2js');
83
+
84
+ var parser = new xml2js.Parser();
85
+ fs.readFile(__dirname + '/foo.xml', function(err, data) {
86
+ parser.parseString(data, function (err, result) {
87
+ console.dir(result);
88
+ console.log('Done');
89
+ });
90
+ });
91
+ ```
92
+
93
+ Look ma, no event listeners!
94
+
95
+ You can also use `xml2js` from
96
+ [CoffeeScript](https://github.com/jashkenas/coffeescript), further reducing
97
+ the clutter:
98
+
99
+ ```coffeescript
100
+ fs = require 'fs',
101
+ xml2js = require 'xml2js'
102
+
103
+ parser = new xml2js.Parser()
104
+ fs.readFile __dirname + '/foo.xml', (err, data) ->
105
+ parser.parseString data, (err, result) ->
106
+ console.dir result
107
+ console.log 'Done.'
108
+ ```
109
+
110
+ But what happens if you forget the `new` keyword to create a new `Parser`? In
111
+ the middle of a nightly coding session, it might get lost, after all. Worry
112
+ not, we got you covered! Starting with 0.2.8 you can also leave it out, in
113
+ which case `xml2js` will helpfully add it for you, no bad surprises and
114
+ inexplicable bugs!
115
+
116
+ Promise usage
117
+ -------------
118
+
119
+ ```javascript
120
+ var xml2js = require('xml2js');
121
+ var xml = '<foo></foo>';
122
+
123
+ // With parser
124
+ var parser = new xml2js.Parser(/* options */);
125
+ parser.parseStringPromise(xml).then(function (result) {
126
+ console.dir(result);
127
+ console.log('Done');
128
+ })
129
+ .catch(function (err) {
130
+ // Failed
131
+ });
132
+
133
+ // Without parser
134
+ xml2js.parseStringPromise(xml /*, options */).then(function (result) {
135
+ console.dir(result);
136
+ console.log('Done');
137
+ })
138
+ .catch(function (err) {
139
+ // Failed
140
+ });
141
+ ```
142
+
143
+ Parsing multiple files
144
+ ----------------------
145
+
146
+ If you want to parse multiple files, you have multiple possibilities:
147
+
148
+ * You can create one `xml2js.Parser` per file. That's the recommended one
149
+ and is promised to always *just work*.
150
+ * You can call `reset()` on your parser object.
151
+ * You can hope everything goes well anyway. This behaviour is not
152
+ guaranteed work always, if ever. Use option #1 if possible. Thanks!
153
+
154
+ So you wanna some JSON?
155
+ -----------------------
156
+
157
+ Just wrap the `result` object in a call to `JSON.stringify` like this
158
+ `JSON.stringify(result)`. You get a string containing the JSON representation
159
+ of the parsed object that you can feed to JSON-hungry consumers.
160
+
161
+ Displaying results
162
+ ------------------
163
+
164
+ You might wonder why, using `console.dir` or `console.log` the output at some
165
+ level is only `[Object]`. Don't worry, this is not because `xml2js` got lazy.
166
+ That's because Node uses `util.inspect` to convert the object into strings and
167
+ that function stops after `depth=2` which is a bit low for most XML.
168
+
169
+ To display the whole deal, you can use `console.log(util.inspect(result, false,
170
+ null))`, which displays the whole result.
171
+
172
+ So much for that, but what if you use
173
+ [eyes](https://github.com/cloudhead/eyes.js) for nice colored output and it
174
+ truncates the output with `…`? Don't fear, there's also a solution for that,
175
+ you just need to increase the `maxLength` limit by creating a custom inspector
176
+ `var inspect = require('eyes').inspector({maxLength: false})` and then you can
177
+ easily `inspect(result)`.
178
+
179
+ XML builder usage
180
+ -----------------
181
+
182
+ Since 0.4.0, objects can be also be used to build XML:
183
+
184
+ ```javascript
185
+ var xml2js = require('xml2js');
186
+
187
+ var obj = {name: "Super", Surname: "Man", age: 23};
188
+
189
+ var builder = new xml2js.Builder();
190
+ var xml = builder.buildObject(obj);
191
+ ```
192
+ will result in:
193
+
194
+ ```xml
195
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
196
+ <root>
197
+ <name>Super</name>
198
+ <Surname>Man</Surname>
199
+ <age>23</age>
200
+ </root>
201
+ ```
202
+
203
+ At the moment, a one to one bi-directional conversion is guaranteed only for
204
+ default configuration, except for `attrkey`, `charkey` and `explicitArray` options
205
+ you can redefine to your taste. Writing CDATA is supported via setting the `cdata`
206
+ option to `true`.
207
+
208
+ To specify attributes:
209
+ ```javascript
210
+ var xml2js = require('xml2js');
211
+
212
+ var obj = {root: {$: {id: "my id"}, _: "my inner text"}};
213
+
214
+ var builder = new xml2js.Builder();
215
+ var xml = builder.buildObject(obj);
216
+ ```
217
+ will result in:
218
+ ```xml
219
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
220
+ <root id="my id">my inner text</root>
221
+ ```
222
+
223
+ ### Adding xmlns attributes
224
+
225
+ You can generate XML that declares XML namespace prefix / URI pairs with xmlns attributes.
226
+
227
+ Example declaring a default namespace on the root element:
228
+
229
+ ```javascript
230
+ let obj = {
231
+ Foo: {
232
+ $: {
233
+ "xmlns": "http://foo.com"
234
+ }
235
+ }
236
+ };
237
+ ```
238
+ Result of `buildObject(obj)`:
239
+ ```xml
240
+ <Foo xmlns="http://foo.com"/>
241
+ ```
242
+ Example declaring non-default namespaces on non-root elements:
243
+ ```javascript
244
+ let obj = {
245
+ 'foo:Foo': {
246
+ $: {
247
+ 'xmlns:foo': 'http://foo.com'
248
+ },
249
+ 'bar:Bar': {
250
+ $: {
251
+ 'xmlns:bar': 'http://bar.com'
252
+ }
253
+ }
254
+ }
255
+ }
256
+ ```
257
+ Result of `buildObject(obj)`:
258
+ ```xml
259
+ <foo:Foo xmlns:foo="http://foo.com">
260
+ <bar:Bar xmlns:bar="http://bar.com"/>
261
+ </foo:Foo>
262
+ ```
263
+
264
+
265
+ Processing attribute, tag names and values
266
+ ------------------------------------------
267
+
268
+ Since 0.4.1 you can optionally provide the parser with attribute name and tag name processors as well as element value processors (Since 0.4.14, you can also optionally provide the parser with attribute value processors):
269
+
270
+ ```javascript
271
+
272
+ function nameToUpperCase(name){
273
+ return name.toUpperCase();
274
+ }
275
+
276
+ //transform all attribute and tag names and values to uppercase
277
+ parseString(xml, {
278
+ tagNameProcessors: [nameToUpperCase],
279
+ attrNameProcessors: [nameToUpperCase],
280
+ valueProcessors: [nameToUpperCase],
281
+ attrValueProcessors: [nameToUpperCase]},
282
+ function (err, result) {
283
+ // processed data
284
+ });
285
+ ```
286
+
287
+ The `tagNameProcessors` and `attrNameProcessors` options
288
+ accept an `Array` of functions with the following signature:
289
+
290
+ ```javascript
291
+ function (name){
292
+ //do something with `name`
293
+ return name
294
+ }
295
+ ```
296
+
297
+ The `attrValueProcessors` and `valueProcessors` options
298
+ accept an `Array` of functions with the following signature:
299
+
300
+ ```javascript
301
+ function (value, name) {
302
+ //`name` will be the node name or attribute name
303
+ //do something with `value`, (optionally) dependent on the node/attr name
304
+ return value
305
+ }
306
+ ```
307
+
308
+ Some processors are provided out-of-the-box and can be found in `lib/processors.js`:
309
+
310
+ - `normalize`: transforms the name to lowercase.
311
+ (Automatically used when `options.normalize` is set to `true`)
312
+
313
+ - `firstCharLowerCase`: transforms the first character to lower case.
314
+ E.g. 'MyTagName' becomes 'myTagName'
315
+
316
+ - `stripPrefix`: strips the xml namespace prefix. E.g `<foo:Bar/>` will become 'Bar'.
317
+ (N.B.: the `xmlns` prefix is NOT stripped.)
318
+
319
+ - `parseNumbers`: parses integer-like strings as integers and float-like strings as floats
320
+ E.g. "0" becomes 0 and "15.56" becomes 15.56
321
+
322
+ - `parseBooleans`: parses boolean-like strings to booleans
323
+ E.g. "true" becomes true and "False" becomes false
324
+
325
+ Options
326
+ =======
327
+
328
+ Apart from the default settings, there are a number of options that can be
329
+ specified for the parser. Options are specified by ``new Parser({optionName:
330
+ value})``. Possible options are:
331
+
332
+ * `attrkey` (default: `$`): Prefix that is used to access the attributes.
333
+ Version 0.1 default was `@`.
334
+ * `charkey` (default: `_`): Prefix that is used to access the character
335
+ content. Version 0.1 default was `#`.
336
+ * `explicitCharkey` (default: `false`) Determines whether or not to use
337
+ a `charkey` prefix for elements with no attributes.
338
+ * `trim` (default: `false`): Trim the whitespace at the beginning and end of
339
+ text nodes.
340
+ * `normalizeTags` (default: `false`): Normalize all tag names to lowercase.
341
+ * `normalize` (default: `false`): Trim whitespaces inside text nodes.
342
+ * `explicitRoot` (default: `true`): Set this if you want to get the root
343
+ node in the resulting object.
344
+ * `emptyTag` (default: `''`): what will the value of empty nodes be. In case
345
+ you want to use an empty object as a default value, it is better to provide a factory
346
+ function `() => ({})` instead. Without this function a plain object would
347
+ become a shared reference across all occurrences with unwanted behavior.
348
+ * `explicitArray` (default: `true`): Always put child nodes in an array if
349
+ true; otherwise an array is created only if there is more than one.
350
+ * `ignoreAttrs` (default: `false`): Ignore all XML attributes and only create
351
+ text nodes.
352
+ * `mergeAttrs` (default: `false`): Merge attributes and child elements as
353
+ properties of the parent, instead of keying attributes off a child
354
+ attribute object. This option is ignored if `ignoreAttrs` is `true`.
355
+ * `validator` (default `null`): You can specify a callable that validates
356
+ the resulting structure somehow, however you want. See unit tests
357
+ for an example.
358
+ * `xmlns` (default `false`): Give each element a field usually called '$ns'
359
+ (the first character is the same as attrkey) that contains its local name
360
+ and namespace URI.
361
+ * `explicitChildren` (default `false`): Put child elements to separate
362
+ property. Doesn't work with `mergeAttrs = true`. If element has no children
363
+ then "children" won't be created. Added in 0.2.5.
364
+ * `childkey` (default `$$`): Prefix that is used to access child elements if
365
+ `explicitChildren` is set to `true`. Added in 0.2.5.
366
+ * `preserveChildrenOrder` (default `false`): Modifies the behavior of
367
+ `explicitChildren` so that the value of the "children" property becomes an
368
+ ordered array. When this is `true`, every node will also get a `#name` field
369
+ whose value will correspond to the XML nodeName, so that you may iterate
370
+ the "children" array and still be able to determine node names. The named
371
+ (and potentially unordered) properties are also retained in this
372
+ configuration at the same level as the ordered "children" array. Added in
373
+ 0.4.9.
374
+ * `charsAsChildren` (default `false`): Determines whether chars should be
375
+ considered children if `explicitChildren` is on. Added in 0.2.5.
376
+ * `includeWhiteChars` (default `false`): Determines whether whitespace-only
377
+ text nodes should be included. Added in 0.4.17.
378
+ * `async` (default `false`): Should the callbacks be async? This *might* be
379
+ an incompatible change if your code depends on sync execution of callbacks.
380
+ Future versions of `xml2js` might change this default, so the recommendation
381
+ is to not depend on sync execution anyway. Added in 0.2.6.
382
+ * `strict` (default `true`): Set sax-js to strict or non-strict parsing mode.
383
+ Defaults to `true` which is *highly* recommended, since parsing HTML which
384
+ is not well-formed XML might yield just about anything. Added in 0.2.7.
385
+ * `attrNameProcessors` (default: `null`): Allows the addition of attribute
386
+ name processing functions. Accepts an `Array` of functions with following
387
+ signature:
388
+ ```javascript
389
+ function (name){
390
+ //do something with `name`
391
+ return name
392
+ }
393
+ ```
394
+ Added in 0.4.14
395
+ * `attrValueProcessors` (default: `null`): Allows the addition of attribute
396
+ value processing functions. Accepts an `Array` of functions with following
397
+ signature:
398
+ ```javascript
399
+ function (value, name){
400
+ //do something with `name`
401
+ return name
402
+ }
403
+ ```
404
+ Added in 0.4.1
405
+ * `tagNameProcessors` (default: `null`): Allows the addition of tag name
406
+ processing functions. Accepts an `Array` of functions with following
407
+ signature:
408
+ ```javascript
409
+ function (name){
410
+ //do something with `name`
411
+ return name
412
+ }
413
+ ```
414
+ Added in 0.4.1
415
+ * `valueProcessors` (default: `null`): Allows the addition of element value
416
+ processing functions. Accepts an `Array` of functions with following
417
+ signature:
418
+ ```javascript
419
+ function (value, name){
420
+ //do something with `name`
421
+ return name
422
+ }
423
+ ```
424
+ Added in 0.4.6
425
+
426
+ Options for the `Builder` class
427
+ -------------------------------
428
+ These options are specified by ``new Builder({optionName: value})``.
429
+ Possible options are:
430
+
431
+ * `attrkey` (default: `$`): Prefix that is used to access the attributes.
432
+ Version 0.1 default was `@`.
433
+ * `charkey` (default: `_`): Prefix that is used to access the character
434
+ content. Version 0.1 default was `#`.
435
+ * `rootName` (default `root` or the root key name): root element name to be used in case
436
+ `explicitRoot` is `false` or to override the root element name.
437
+ * `renderOpts` (default `{ 'pretty': true, 'indent': ' ', 'newline': '\n' }`):
438
+ Rendering options for xmlbuilder-js.
439
+ * pretty: prettify generated XML
440
+ * indent: whitespace for indentation (only when pretty)
441
+ * newline: newline char (only when pretty)
442
+ * `xmldec` (default `{ 'version': '1.0', 'encoding': 'UTF-8', 'standalone': true }`:
443
+ XML declaration attributes.
444
+ * `xmldec.version` A version number string, e.g. 1.0
445
+ * `xmldec.encoding` Encoding declaration, e.g. UTF-8
446
+ * `xmldec.standalone` standalone document declaration: true or false
447
+ * `doctype` (default `null`): optional DTD. Eg. `{'ext': 'hello.dtd'}`
448
+ * `headless` (default: `false`): omit the XML header. Added in 0.4.3.
449
+ * `allowSurrogateChars` (default: `false`): allows using characters from the Unicode
450
+ surrogate blocks.
451
+ * `cdata` (default: `false`): wrap text nodes in `<![CDATA[ ... ]]>` instead of
452
+ escaping when necessary. Does not add `<![CDATA[ ... ]]>` if it is not required.
453
+ Added in 0.4.5.
454
+
455
+ `renderOpts`, `xmldec`,`doctype` and `headless` pass through to
456
+ [xmlbuilder-js](https://github.com/oozcitak/xmlbuilder-js).
457
+
458
+ Updating to new version
459
+ =======================
460
+
461
+ Version 0.2 changed the default parsing settings, but version 0.1.14 introduced
462
+ the default settings for version 0.2, so these settings can be tried before the
463
+ migration.
464
+
465
+ ```javascript
466
+ var xml2js = require('xml2js');
467
+ var parser = new xml2js.Parser(xml2js.defaults["0.2"]);
468
+ ```
469
+
470
+ To get the 0.1 defaults in version 0.2 you can just use
471
+ `xml2js.defaults["0.1"]` in the same place. This provides you with enough time
472
+ to migrate to the saner way of parsing in `xml2js` 0.2. We try to make the
473
+ migration as simple and gentle as possible, but some breakage cannot be
474
+ avoided.
475
+
476
+ So, what exactly did change and why? In 0.2 we changed some defaults to parse
477
+ the XML in a more universal and sane way. So we disabled `normalize` and `trim`
478
+ so `xml2js` does not cut out any text content. You can reenable this at will of
479
+ course. A more important change is that we return the root tag in the resulting
480
+ JavaScript structure via the `explicitRoot` setting, so you need to access the
481
+ first element. This is useful for anybody who wants to know what the root node
482
+ is and preserves more information. The last major change was to enable
483
+ `explicitArray`, so everytime it is possible that one might embed more than one
484
+ sub-tag into a tag, xml2js >= 0.2 returns an array even if the array just
485
+ includes one element. This is useful when dealing with APIs that return
486
+ variable amounts of subtags.
487
+
488
+ Running tests, development
489
+ ==========================
490
+
491
+ [![Build Status](https://travis-ci.org/Leonidas-from-XIV/node-xml2js.svg?branch=master)](https://travis-ci.org/Leonidas-from-XIV/node-xml2js)
492
+ [![Coverage Status](https://coveralls.io/repos/Leonidas-from-XIV/node-xml2js/badge.svg?branch=)](https://coveralls.io/r/Leonidas-from-XIV/node-xml2js?branch=master)
493
+ [![Dependency Status](https://david-dm.org/Leonidas-from-XIV/node-xml2js.svg)](https://david-dm.org/Leonidas-from-XIV/node-xml2js)
494
+
495
+ The development requirements are handled by npm, you just need to install them.
496
+ We also have a number of unit tests, they can be run using `npm test` directly
497
+ from the project root. This runs zap to discover all the tests and execute
498
+ them.
499
+
500
+ If you like to contribute, keep in mind that `xml2js` is written in
501
+ CoffeeScript, so don't develop on the JavaScript files that are checked into
502
+ the repository for convenience reasons. Also, please write some unit test to
503
+ check your behaviour and if it is some user-facing thing, add some
504
+ documentation to this README, so people will know it exists. Thanks in advance!
505
+
506
+ Getting support
507
+ ===============
508
+
509
+ Please, if you have a problem with the library, first make sure you read this
510
+ README. If you read this far, thanks, you're good. Then, please make sure your
511
+ problem really is with `xml2js`. It is? Okay, then I'll look at it. Send me a
512
+ mail and we can talk. Please don't open issues, as I don't think that is the
513
+ proper forum for support problems. Some problems might as well really be bugs
514
+ in `xml2js`, if so I'll let you know to open an issue instead :)
515
+
516
+ But if you know you really found a bug, feel free to open an issue instead.
package/lib/bom.js ADDED
@@ -0,0 +1,12 @@
1
+ // Generated by CoffeeScript 1.12.7
2
+ (function() {
3
+ "use strict";
4
+ exports.stripBOM = function(str) {
5
+ if (str[0] === '\uFEFF') {
6
+ return str.substring(1);
7
+ } else {
8
+ return str;
9
+ }
10
+ };
11
+
12
+ }).call(this);
package/lib/builder.js ADDED
@@ -0,0 +1,127 @@
1
+ // Generated by CoffeeScript 1.12.7
2
+ (function() {
3
+ "use strict";
4
+ var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA,
5
+ hasProp = {}.hasOwnProperty;
6
+
7
+ builder = require('xmlbuilder');
8
+
9
+ defaults = require('./defaults').defaults;
10
+
11
+ requiresCDATA = function(entry) {
12
+ return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0);
13
+ };
14
+
15
+ wrapCDATA = function(entry) {
16
+ return "<![CDATA[" + (escapeCDATA(entry)) + "]]>";
17
+ };
18
+
19
+ escapeCDATA = function(entry) {
20
+ return entry.replace(']]>', ']]]]><![CDATA[>');
21
+ };
22
+
23
+ exports.Builder = (function() {
24
+ function Builder(opts) {
25
+ var key, ref, value;
26
+ this.options = {};
27
+ ref = defaults["0.2"];
28
+ for (key in ref) {
29
+ if (!hasProp.call(ref, key)) continue;
30
+ value = ref[key];
31
+ this.options[key] = value;
32
+ }
33
+ for (key in opts) {
34
+ if (!hasProp.call(opts, key)) continue;
35
+ value = opts[key];
36
+ this.options[key] = value;
37
+ }
38
+ }
39
+
40
+ Builder.prototype.buildObject = function(rootObj) {
41
+ var attrkey, charkey, render, rootElement, rootName;
42
+ attrkey = this.options.attrkey;
43
+ charkey = this.options.charkey;
44
+ if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) {
45
+ rootName = Object.keys(rootObj)[0];
46
+ rootObj = rootObj[rootName];
47
+ } else {
48
+ rootName = this.options.rootName;
49
+ }
50
+ render = (function(_this) {
51
+ return function(element, obj) {
52
+ var attr, child, entry, index, key, value;
53
+ if (typeof obj !== 'object') {
54
+ if (_this.options.cdata && requiresCDATA(obj)) {
55
+ element.raw(wrapCDATA(obj));
56
+ } else {
57
+ element.txt(obj);
58
+ }
59
+ } else if (Array.isArray(obj)) {
60
+ for (index in obj) {
61
+ if (!hasProp.call(obj, index)) continue;
62
+ child = obj[index];
63
+ for (key in child) {
64
+ entry = child[key];
65
+ element = render(element.ele(key), entry).up();
66
+ }
67
+ }
68
+ } else {
69
+ for (key in obj) {
70
+ if (!hasProp.call(obj, key)) continue;
71
+ child = obj[key];
72
+ if (key === attrkey) {
73
+ if (typeof child === "object") {
74
+ for (attr in child) {
75
+ value = child[attr];
76
+ element = element.att(attr, value);
77
+ }
78
+ }
79
+ } else if (key === charkey) {
80
+ if (_this.options.cdata && requiresCDATA(child)) {
81
+ element = element.raw(wrapCDATA(child));
82
+ } else {
83
+ element = element.txt(child);
84
+ }
85
+ } else if (Array.isArray(child)) {
86
+ for (index in child) {
87
+ if (!hasProp.call(child, index)) continue;
88
+ entry = child[index];
89
+ if (typeof entry === 'string') {
90
+ if (_this.options.cdata && requiresCDATA(entry)) {
91
+ element = element.ele(key).raw(wrapCDATA(entry)).up();
92
+ } else {
93
+ element = element.ele(key, entry).up();
94
+ }
95
+ } else {
96
+ element = render(element.ele(key), entry).up();
97
+ }
98
+ }
99
+ } else if (typeof child === "object") {
100
+ element = render(element.ele(key), child).up();
101
+ } else {
102
+ if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) {
103
+ element = element.ele(key).raw(wrapCDATA(child)).up();
104
+ } else {
105
+ if (child == null) {
106
+ child = '';
107
+ }
108
+ element = element.ele(key, child.toString()).up();
109
+ }
110
+ }
111
+ }
112
+ }
113
+ return element;
114
+ };
115
+ })(this);
116
+ rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {
117
+ headless: this.options.headless,
118
+ allowSurrogateChars: this.options.allowSurrogateChars
119
+ });
120
+ return render(rootElement, rootObj).end(this.options.renderOpts);
121
+ };
122
+
123
+ return Builder;
124
+
125
+ })();
126
+
127
+ }).call(this);
@@ -0,0 +1,72 @@
1
+ // Generated by CoffeeScript 1.12.7
2
+ (function() {
3
+ exports.defaults = {
4
+ "0.1": {
5
+ explicitCharkey: false,
6
+ trim: true,
7
+ normalize: true,
8
+ normalizeTags: false,
9
+ attrkey: "@",
10
+ charkey: "#",
11
+ explicitArray: false,
12
+ ignoreAttrs: false,
13
+ mergeAttrs: false,
14
+ explicitRoot: false,
15
+ validator: null,
16
+ xmlns: false,
17
+ explicitChildren: false,
18
+ childkey: '@@',
19
+ charsAsChildren: false,
20
+ includeWhiteChars: false,
21
+ async: false,
22
+ strict: true,
23
+ attrNameProcessors: null,
24
+ attrValueProcessors: null,
25
+ tagNameProcessors: null,
26
+ valueProcessors: null,
27
+ emptyTag: ''
28
+ },
29
+ "0.2": {
30
+ explicitCharkey: false,
31
+ trim: false,
32
+ normalize: false,
33
+ normalizeTags: false,
34
+ attrkey: "$",
35
+ charkey: "_",
36
+ explicitArray: true,
37
+ ignoreAttrs: false,
38
+ mergeAttrs: false,
39
+ explicitRoot: true,
40
+ validator: null,
41
+ xmlns: false,
42
+ explicitChildren: false,
43
+ preserveChildrenOrder: false,
44
+ childkey: '$$',
45
+ charsAsChildren: false,
46
+ includeWhiteChars: false,
47
+ async: false,
48
+ strict: true,
49
+ attrNameProcessors: null,
50
+ attrValueProcessors: null,
51
+ tagNameProcessors: null,
52
+ valueProcessors: null,
53
+ rootName: 'root',
54
+ xmldec: {
55
+ 'version': '1.0',
56
+ 'encoding': 'UTF-8',
57
+ 'standalone': true
58
+ },
59
+ doctype: null,
60
+ renderOpts: {
61
+ 'pretty': true,
62
+ 'indent': ' ',
63
+ 'newline': '\n'
64
+ },
65
+ headless: false,
66
+ chunkSize: 10000,
67
+ emptyTag: '',
68
+ cdata: false
69
+ }
70
+ };
71
+
72
+ }).call(this);
package/lib/parser.js ADDED
@@ -0,0 +1,395 @@
1
+ // Generated by CoffeeScript 1.12.7
2
+ (function() {
3
+ "use strict";
4
+ var bom, defaults, defineProperty, events, isEmpty, processItem, processors, sax, setImmediate,
5
+ bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
6
+ 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; },
7
+ hasProp = {}.hasOwnProperty;
8
+
9
+ sax = require('sax');
10
+
11
+ events = require('events');
12
+
13
+ bom = require('./bom');
14
+
15
+ processors = require('./processors');
16
+
17
+ setImmediate = require('timers').setImmediate;
18
+
19
+ defaults = require('./defaults').defaults;
20
+
21
+ isEmpty = function(thing) {
22
+ return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0;
23
+ };
24
+
25
+ processItem = function(processors, item, key) {
26
+ var i, len, process;
27
+ for (i = 0, len = processors.length; i < len; i++) {
28
+ process = processors[i];
29
+ item = process(item, key);
30
+ }
31
+ return item;
32
+ };
33
+
34
+ defineProperty = function(obj, key, value) {
35
+ var descriptor;
36
+ descriptor = Object.create(null);
37
+ descriptor.value = value;
38
+ descriptor.writable = true;
39
+ descriptor.enumerable = true;
40
+ descriptor.configurable = true;
41
+ return Object.defineProperty(obj, key, descriptor);
42
+ };
43
+
44
+ exports.Parser = (function(superClass) {
45
+ extend(Parser, superClass);
46
+
47
+ function Parser(opts) {
48
+ this.parseStringPromise = bind(this.parseStringPromise, this);
49
+ this.parseString = bind(this.parseString, this);
50
+ this.reset = bind(this.reset, this);
51
+ this.assignOrPush = bind(this.assignOrPush, this);
52
+ this.processAsync = bind(this.processAsync, this);
53
+ var key, ref, value;
54
+ if (!(this instanceof exports.Parser)) {
55
+ return new exports.Parser(opts);
56
+ }
57
+ this.options = {};
58
+ ref = defaults["0.2"];
59
+ for (key in ref) {
60
+ if (!hasProp.call(ref, key)) continue;
61
+ value = ref[key];
62
+ this.options[key] = value;
63
+ }
64
+ for (key in opts) {
65
+ if (!hasProp.call(opts, key)) continue;
66
+ value = opts[key];
67
+ this.options[key] = value;
68
+ }
69
+ if (this.options.xmlns) {
70
+ this.options.xmlnskey = this.options.attrkey + "ns";
71
+ }
72
+ if (this.options.normalizeTags) {
73
+ if (!this.options.tagNameProcessors) {
74
+ this.options.tagNameProcessors = [];
75
+ }
76
+ this.options.tagNameProcessors.unshift(processors.normalize);
77
+ }
78
+ this.reset();
79
+ }
80
+
81
+ Parser.prototype.processAsync = function() {
82
+ var chunk, err;
83
+ try {
84
+ if (this.remaining.length <= this.options.chunkSize) {
85
+ chunk = this.remaining;
86
+ this.remaining = '';
87
+ this.saxParser = this.saxParser.write(chunk);
88
+ return this.saxParser.close();
89
+ } else {
90
+ chunk = this.remaining.substr(0, this.options.chunkSize);
91
+ this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length);
92
+ this.saxParser = this.saxParser.write(chunk);
93
+ return setImmediate(this.processAsync);
94
+ }
95
+ } catch (error1) {
96
+ err = error1;
97
+ if (!this.saxParser.errThrown) {
98
+ this.saxParser.errThrown = true;
99
+ return this.emit(err);
100
+ }
101
+ }
102
+ };
103
+
104
+ Parser.prototype.assignOrPush = function(obj, key, newValue) {
105
+ if (!(key in obj)) {
106
+ if (!this.options.explicitArray) {
107
+ return defineProperty(obj, key, newValue);
108
+ } else {
109
+ return defineProperty(obj, key, [newValue]);
110
+ }
111
+ } else {
112
+ if (!(obj[key] instanceof Array)) {
113
+ defineProperty(obj, key, [obj[key]]);
114
+ }
115
+ return obj[key].push(newValue);
116
+ }
117
+ };
118
+
119
+ Parser.prototype.reset = function() {
120
+ var attrkey, charkey, ontext, stack;
121
+ this.removeAllListeners();
122
+ this.saxParser = sax.parser(this.options.strict, {
123
+ trim: false,
124
+ normalize: false,
125
+ xmlns: this.options.xmlns
126
+ });
127
+ this.saxParser.errThrown = false;
128
+ this.saxParser.onerror = (function(_this) {
129
+ return function(error) {
130
+ _this.saxParser.resume();
131
+ if (!_this.saxParser.errThrown) {
132
+ _this.saxParser.errThrown = true;
133
+ return _this.emit("error", error);
134
+ }
135
+ };
136
+ })(this);
137
+ this.saxParser.onend = (function(_this) {
138
+ return function() {
139
+ if (!_this.saxParser.ended) {
140
+ _this.saxParser.ended = true;
141
+ return _this.emit("end", _this.resultObject);
142
+ }
143
+ };
144
+ })(this);
145
+ this.saxParser.ended = false;
146
+ this.EXPLICIT_CHARKEY = this.options.explicitCharkey;
147
+ this.resultObject = null;
148
+ stack = [];
149
+ attrkey = this.options.attrkey;
150
+ charkey = this.options.charkey;
151
+ this.saxParser.onopentag = (function(_this) {
152
+ return function(node) {
153
+ var key, newValue, obj, processedKey, ref;
154
+ obj = {};
155
+ obj[charkey] = "";
156
+ if (!_this.options.ignoreAttrs) {
157
+ ref = node.attributes;
158
+ for (key in ref) {
159
+ if (!hasProp.call(ref, key)) continue;
160
+ if (!(attrkey in obj) && !_this.options.mergeAttrs) {
161
+ obj[attrkey] = {};
162
+ }
163
+ newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
164
+ processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
165
+ if (_this.options.mergeAttrs) {
166
+ _this.assignOrPush(obj, processedKey, newValue);
167
+ } else {
168
+ defineProperty(obj[attrkey], processedKey, newValue);
169
+ }
170
+ }
171
+ }
172
+ obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name;
173
+ if (_this.options.xmlns) {
174
+ obj[_this.options.xmlnskey] = {
175
+ uri: node.uri,
176
+ local: node.local
177
+ };
178
+ }
179
+ return stack.push(obj);
180
+ };
181
+ })(this);
182
+ this.saxParser.onclosetag = (function(_this) {
183
+ return function() {
184
+ var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;
185
+ obj = stack.pop();
186
+ nodeName = obj["#name"];
187
+ if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) {
188
+ delete obj["#name"];
189
+ }
190
+ if (obj.cdata === true) {
191
+ cdata = obj.cdata;
192
+ delete obj.cdata;
193
+ }
194
+ s = stack[stack.length - 1];
195
+ if (obj[charkey].match(/^\s*$/) && !cdata) {
196
+ emptyStr = obj[charkey];
197
+ delete obj[charkey];
198
+ } else {
199
+ if (_this.options.trim) {
200
+ obj[charkey] = obj[charkey].trim();
201
+ }
202
+ if (_this.options.normalize) {
203
+ obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim();
204
+ }
205
+ obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey];
206
+ if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
207
+ obj = obj[charkey];
208
+ }
209
+ }
210
+ if (isEmpty(obj)) {
211
+ if (typeof _this.options.emptyTag === 'function') {
212
+ obj = _this.options.emptyTag();
213
+ } else {
214
+ obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr;
215
+ }
216
+ }
217
+ if (_this.options.validator != null) {
218
+ xpath = "/" + ((function() {
219
+ var i, len, results;
220
+ results = [];
221
+ for (i = 0, len = stack.length; i < len; i++) {
222
+ node = stack[i];
223
+ results.push(node["#name"]);
224
+ }
225
+ return results;
226
+ })()).concat(nodeName).join("/");
227
+ (function() {
228
+ var err;
229
+ try {
230
+ return obj = _this.options.validator(xpath, s && s[nodeName], obj);
231
+ } catch (error1) {
232
+ err = error1;
233
+ return _this.emit("error", err);
234
+ }
235
+ })();
236
+ }
237
+ if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') {
238
+ if (!_this.options.preserveChildrenOrder) {
239
+ node = {};
240
+ if (_this.options.attrkey in obj) {
241
+ node[_this.options.attrkey] = obj[_this.options.attrkey];
242
+ delete obj[_this.options.attrkey];
243
+ }
244
+ if (!_this.options.charsAsChildren && _this.options.charkey in obj) {
245
+ node[_this.options.charkey] = obj[_this.options.charkey];
246
+ delete obj[_this.options.charkey];
247
+ }
248
+ if (Object.getOwnPropertyNames(obj).length > 0) {
249
+ node[_this.options.childkey] = obj;
250
+ }
251
+ obj = node;
252
+ } else if (s) {
253
+ s[_this.options.childkey] = s[_this.options.childkey] || [];
254
+ objClone = {};
255
+ for (key in obj) {
256
+ if (!hasProp.call(obj, key)) continue;
257
+ defineProperty(objClone, key, obj[key]);
258
+ }
259
+ s[_this.options.childkey].push(objClone);
260
+ delete obj["#name"];
261
+ if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
262
+ obj = obj[charkey];
263
+ }
264
+ }
265
+ }
266
+ if (stack.length > 0) {
267
+ return _this.assignOrPush(s, nodeName, obj);
268
+ } else {
269
+ if (_this.options.explicitRoot) {
270
+ old = obj;
271
+ obj = {};
272
+ defineProperty(obj, nodeName, old);
273
+ }
274
+ _this.resultObject = obj;
275
+ _this.saxParser.ended = true;
276
+ return _this.emit("end", _this.resultObject);
277
+ }
278
+ };
279
+ })(this);
280
+ ontext = (function(_this) {
281
+ return function(text) {
282
+ var charChild, s;
283
+ s = stack[stack.length - 1];
284
+ if (s) {
285
+ s[charkey] += text;
286
+ if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) {
287
+ s[_this.options.childkey] = s[_this.options.childkey] || [];
288
+ charChild = {
289
+ '#name': '__text__'
290
+ };
291
+ charChild[charkey] = text;
292
+ if (_this.options.normalize) {
293
+ charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim();
294
+ }
295
+ s[_this.options.childkey].push(charChild);
296
+ }
297
+ return s;
298
+ }
299
+ };
300
+ })(this);
301
+ this.saxParser.ontext = ontext;
302
+ return this.saxParser.oncdata = (function(_this) {
303
+ return function(text) {
304
+ var s;
305
+ s = ontext(text);
306
+ if (s) {
307
+ return s.cdata = true;
308
+ }
309
+ };
310
+ })(this);
311
+ };
312
+
313
+ Parser.prototype.parseString = function(str, cb) {
314
+ var err;
315
+ if ((cb != null) && typeof cb === "function") {
316
+ this.on("end", function(result) {
317
+ this.reset();
318
+ return cb(null, result);
319
+ });
320
+ this.on("error", function(err) {
321
+ this.reset();
322
+ return cb(err);
323
+ });
324
+ }
325
+ try {
326
+ str = str.toString();
327
+ if (str.trim() === '') {
328
+ this.emit("end", null);
329
+ return true;
330
+ }
331
+ str = bom.stripBOM(str);
332
+ if (this.options.async) {
333
+ this.remaining = str;
334
+ setImmediate(this.processAsync);
335
+ return this.saxParser;
336
+ }
337
+ return this.saxParser.write(str).close();
338
+ } catch (error1) {
339
+ err = error1;
340
+ if (!(this.saxParser.errThrown || this.saxParser.ended)) {
341
+ this.emit('error', err);
342
+ return this.saxParser.errThrown = true;
343
+ } else if (this.saxParser.ended) {
344
+ throw err;
345
+ }
346
+ }
347
+ };
348
+
349
+ Parser.prototype.parseStringPromise = function(str) {
350
+ return new Promise((function(_this) {
351
+ return function(resolve, reject) {
352
+ return _this.parseString(str, function(err, value) {
353
+ if (err) {
354
+ return reject(err);
355
+ } else {
356
+ return resolve(value);
357
+ }
358
+ });
359
+ };
360
+ })(this));
361
+ };
362
+
363
+ return Parser;
364
+
365
+ })(events);
366
+
367
+ exports.parseString = function(str, a, b) {
368
+ var cb, options, parser;
369
+ if (b != null) {
370
+ if (typeof b === 'function') {
371
+ cb = b;
372
+ }
373
+ if (typeof a === 'object') {
374
+ options = a;
375
+ }
376
+ } else {
377
+ if (typeof a === 'function') {
378
+ cb = a;
379
+ }
380
+ options = {};
381
+ }
382
+ parser = new exports.Parser(options);
383
+ return parser.parseString(str, cb);
384
+ };
385
+
386
+ exports.parseStringPromise = function(str, a) {
387
+ var options, parser;
388
+ if (typeof a === 'object') {
389
+ options = a;
390
+ }
391
+ parser = new exports.Parser(options);
392
+ return parser.parseStringPromise(str);
393
+ };
394
+
395
+ }).call(this);
@@ -0,0 +1,34 @@
1
+ // Generated by CoffeeScript 1.12.7
2
+ (function() {
3
+ "use strict";
4
+ var prefixMatch;
5
+
6
+ prefixMatch = new RegExp(/(?!xmlns)^.*:/);
7
+
8
+ exports.normalize = function(str) {
9
+ return str.toLowerCase();
10
+ };
11
+
12
+ exports.firstCharLowerCase = function(str) {
13
+ return str.charAt(0).toLowerCase() + str.slice(1);
14
+ };
15
+
16
+ exports.stripPrefix = function(str) {
17
+ return str.replace(prefixMatch, '');
18
+ };
19
+
20
+ exports.parseNumbers = function(str) {
21
+ if (!isNaN(str)) {
22
+ str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);
23
+ }
24
+ return str;
25
+ };
26
+
27
+ exports.parseBooleans = function(str) {
28
+ if (/^(?:true|false)$/i.test(str)) {
29
+ str = str.toLowerCase() === 'true';
30
+ }
31
+ return str;
32
+ };
33
+
34
+ }).call(this);
package/lib/xml2js.js ADDED
@@ -0,0 +1,39 @@
1
+ // Generated by CoffeeScript 1.12.7
2
+ (function() {
3
+ "use strict";
4
+ var builder, defaults, parser, processors,
5
+ 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; },
6
+ hasProp = {}.hasOwnProperty;
7
+
8
+ defaults = require('./defaults');
9
+
10
+ builder = require('./builder');
11
+
12
+ parser = require('./parser');
13
+
14
+ processors = require('./processors');
15
+
16
+ exports.defaults = defaults.defaults;
17
+
18
+ exports.processors = processors;
19
+
20
+ exports.ValidationError = (function(superClass) {
21
+ extend(ValidationError, superClass);
22
+
23
+ function ValidationError(message) {
24
+ this.message = message;
25
+ }
26
+
27
+ return ValidationError;
28
+
29
+ })(Error);
30
+
31
+ exports.Builder = builder.Builder;
32
+
33
+ exports.Parser = parser.Parser;
34
+
35
+ exports.parseString = parser.parseString;
36
+
37
+ exports.parseStringPromise = parser.parseStringPromise;
38
+
39
+ }).call(this);
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@brickhouse-tech/xml2js",
3
+ "description": "Simple XML to JavaScript object converter.",
4
+ "keywords": [
5
+ "xml",
6
+ "json"
7
+ ],
8
+ "homepage": "https://github.com/brickhouse-tech/node-xml2js",
9
+ "version": "0.6.3",
10
+ "author": "Marek Kubica <marek@xivilization.net> (https://xivilization.net)",
11
+ "contributors": [
12
+ "maqr <maqr.lollerskates@gmail.com> (https://github.com/maqr)",
13
+ "Ben Weaver (http://benweaver.com/)",
14
+ "Jae Kwon (https://github.com/jaekwon)",
15
+ "Jim Robert",
16
+ "Ștefan Rusu (http://www.saltwaterc.eu/)",
17
+ "Carter Cole <carter.cole@cartercole.com> (http://cartercole.com/)",
18
+ "Kurt Raschke <kurt@kurtraschke.com> (http://www.kurtraschke.com/)",
19
+ "Contra <contra@australia.edu> (https://github.com/Contra)",
20
+ "Marcelo Diniz <marudiniz@gmail.com> (https://github.com/mdiniz)",
21
+ "Michael Hart (https://github.com/mhart)",
22
+ "Zachary Scott <zachary@zacharyscott.net> (http://zacharyscott.net/)",
23
+ "Raoul Millais (https://github.com/raoulmillais)",
24
+ "Salsita Software (http://www.salsitasoft.com/)",
25
+ "Mike Schilling <mike@emotive.com> (http://www.emotive.com/)",
26
+ "Jackson Tian <shyvo1987@gmail.com> (http://weibo.com/shyvo)",
27
+ "Mikhail Zyatin <mikhail.zyatin@gmail.com> (https://github.com/Sitin)",
28
+ "Chris Tavares <ctavares@microsoft.com> (https://github.com/christav)",
29
+ "Frank Xu <yyfrankyy@gmail.com> (http://f2e.us/)",
30
+ "Guido D'Albore <guido@bitstorm.it> (http://www.bitstorm.it/)",
31
+ "Jack Senechal (http://jacksenechal.com/)",
32
+ "Matthias Hölzl <tc@xantira.com> (https://github.com/hoelzl)",
33
+ "Camille Reynders <info@creynders.be> (http://www.creynders.be/)",
34
+ "Taylor Gautier (https://github.com/tsgautier)",
35
+ "Todd Bryan (https://github.com/toddrbryan)",
36
+ "Leore Avidar <leore.avidar@gmail.com> (http://leoreavidar.com/)",
37
+ "Dave Aitken <dave.aitken@gmail.com> (http://www.actionshrimp.com/)",
38
+ "Shaney Orrowe <shaney.orrowe@practiceweb.co.uk>",
39
+ "Candle <candle@candle.me.uk>",
40
+ "Jess Telford <hi@jes.st> (http://jes.st)",
41
+ "Tom Hughes <<tom@compton.nu> (http://compton.nu/)",
42
+ "Piotr Rochala (http://rocha.la/)",
43
+ "Michael Avila (https://github.com/michaelavila)",
44
+ "Ryan Gahl (https://github.com/ryedin)",
45
+ "Eric Laberge <e.laberge@gmail.com> (https://github.com/elaberge)",
46
+ "Benjamin E. Coe <ben@npmjs.com> (https://twitter.com/benjamincoe)",
47
+ "Stephen Cresswell (https://github.com/cressie176)",
48
+ "Pascal Ehlert <pascal@hacksrus.net> (http://www.hacksrus.net/)",
49
+ "Tom Spencer <fiznool@gmail.com> (http://fiznool.com/)",
50
+ "Tristian Flanagan <tflanagan@datacollaborative.com> (https://github.com/tflanagan)",
51
+ "Tim Johns <timjohns@yahoo.com> (https://github.com/TimJohns)",
52
+ "Bogdan Chadkin <trysound@yandex.ru> (https://github.com/TrySound)",
53
+ "David Wood <david.p.wood@gmail.com> (http://codesleuth.co.uk/)",
54
+ "Nicolas Maquet (https://github.com/nmaquet)",
55
+ "Lovell Fuller (http://lovell.info/)",
56
+ "d3adc0d3 (https://github.com/d3adc0d3)",
57
+ "James Crosby (https://github.com/autopulated)"
58
+ ],
59
+ "main": "./lib/xml2js",
60
+ "files": [
61
+ "lib"
62
+ ],
63
+ "directories": {
64
+ "lib": "./lib"
65
+ },
66
+ "scripts": {
67
+ "build": "cake build",
68
+ "test": "zap",
69
+ "lint": "eslint .",
70
+ "coverage": "nyc npm test && nyc report",
71
+ "doc": "cake doc"
72
+ },
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "https://github.com/brickhouse-tech/node-xml2js.git"
76
+ },
77
+ "dependencies": {
78
+ "sax": "^1.4.4",
79
+ "xmlbuilder": "^15.1.1"
80
+ },
81
+ "devDependencies": {
82
+ "@eslint/js": "^10.0.1",
83
+ "coffee-script": "^1.12.7",
84
+ "coffeescript": ">=1.10.0 <2",
85
+ "diff": "^8.0.3",
86
+ "docco": "^0.9.2",
87
+ "eslint": "^10.0.2",
88
+ "nyc": ">=2.2.1",
89
+ "zap": ">=0.2.9 <1"
90
+ },
91
+ "engines": {
92
+ "node": ">=18.0.0"
93
+ },
94
+ "license": "MIT"
95
+ }