fast-xml-parser 4.5.4 → 4.5.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-xml-parser",
3
- "version": "4.5.4",
3
+ "version": "4.5.6",
4
4
  "description": "Validate XML, Parse XML, Build XML without C/C++ based libraries",
5
5
  "main": "./src/fxp.js",
6
6
  "scripts": {
package/src/fxp.d.ts CHANGED
@@ -34,6 +34,13 @@ export type ProcessEntitiesOptions = {
34
34
  */
35
35
  maxExpandedLength?: number;
36
36
 
37
+ /**
38
+ * Maximum number of entities allowed in the XML
39
+ *
40
+ * Defaults to `100`
41
+ */
42
+ maxEntityCount?: number;
43
+
37
44
  /**
38
45
  * Array of tag names where entity replacement is allowed.
39
46
  * If null, entities are replaced in all tags.
@@ -292,6 +299,16 @@ export type X2jOptions = {
292
299
  * Defaults to `true`
293
300
  */
294
301
  strictReservedNames?: boolean;
302
+
303
+ /**
304
+ * Function to sanitize dangerous property names
305
+ *
306
+ * @param name - The name of the property
307
+ * @returns {string} The sanitized name
308
+ *
309
+ * Defaults to `(name) => __name`
310
+ */
311
+ onDangerousProperty?: (name: string) => string;
295
312
  };
296
313
 
297
314
 
@@ -469,6 +486,13 @@ export type XmlBuilderOptions = {
469
486
 
470
487
 
471
488
  oneListGroup?: boolean;
489
+
490
+ /**
491
+ * Maximum number of nested tags
492
+ *
493
+ * Defaults to `100`
494
+ */
495
+ maxNestedTags?: number;
472
496
  };
473
497
 
474
498
  type ESchema = string | object | Array<string | object>;
package/src/util.js CHANGED
@@ -5,7 +5,7 @@ const nameChar = nameStartChar + '\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
5
5
  const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*'
6
6
  const regexName = new RegExp('^' + nameRegexp + '$');
7
7
 
8
- const getAllMatches = function(string, regex) {
8
+ const getAllMatches = function (string, regex) {
9
9
  const matches = [];
10
10
  let match = regex.exec(string);
11
11
  while (match) {
@@ -21,16 +21,16 @@ const getAllMatches = function(string, regex) {
21
21
  return matches;
22
22
  };
23
23
 
24
- const isName = function(string) {
24
+ const isName = function (string) {
25
25
  const match = regexName.exec(string);
26
26
  return !(match === null || typeof match === 'undefined');
27
27
  };
28
28
 
29
- exports.isExist = function(v) {
29
+ exports.isExist = function (v) {
30
30
  return typeof v !== 'undefined';
31
31
  };
32
32
 
33
- exports.isEmptyObject = function(obj) {
33
+ exports.isEmptyObject = function (obj) {
34
34
  return Object.keys(obj).length === 0;
35
35
  };
36
36
 
@@ -39,13 +39,13 @@ exports.isEmptyObject = function(obj) {
39
39
  * @param {*} target
40
40
  * @param {*} a
41
41
  */
42
- exports.merge = function(target, a, arrayMode) {
42
+ exports.merge = function (target, a, arrayMode) {
43
43
  if (a) {
44
44
  const keys = Object.keys(a); // will return an array of own properties
45
45
  const len = keys.length; //don't make it inline
46
46
  for (let i = 0; i < len; i++) {
47
47
  if (arrayMode === 'strict') {
48
- target[keys[i]] = [ a[keys[i]] ];
48
+ target[keys[i]] = [a[keys[i]]];
49
49
  } else {
50
50
  target[keys[i]] = a[keys[i]];
51
51
  }
@@ -56,7 +56,7 @@ exports.merge = function(target, a, arrayMode) {
56
56
  return Object.assign(b,a);
57
57
  } */
58
58
 
59
- exports.getValue = function(v) {
59
+ exports.getValue = function (v) {
60
60
  if (exports.isExist(v)) {
61
61
  return v;
62
62
  } else {
@@ -64,9 +64,26 @@ exports.getValue = function(v) {
64
64
  }
65
65
  };
66
66
 
67
- // const fakeCall = function(a) {return a;};
68
- // const fakeCallNoReturn = function() {};
67
+ /**
68
+ * Dangerous property names that could lead to prototype pollution or security issues
69
+ */
70
+ const DANGEROUS_PROPERTY_NAMES = [
71
+ // '__proto__',
72
+ // 'constructor',
73
+ // 'prototype',
74
+ 'hasOwnProperty',
75
+ 'toString',
76
+ 'valueOf',
77
+ '__defineGetter__',
78
+ '__defineSetter__',
79
+ '__lookupGetter__',
80
+ '__lookupSetter__'
81
+ ];
82
+
83
+ const criticalProperties = ["__proto__", "constructor", "prototype"];
69
84
 
70
85
  exports.isName = isName;
71
86
  exports.getAllMatches = getAllMatches;
72
87
  exports.nameRegexp = nameRegexp;
88
+ exports.DANGEROUS_PROPERTY_NAMES = DANGEROUS_PROPERTY_NAMES;
89
+ exports.criticalProperties = criticalProperties;
@@ -8,6 +8,7 @@ class DocTypeReader {
8
8
 
9
9
  readDocType(xmlData, i) {
10
10
  const entities = Object.create(null);
11
+ let entityCount = 0;
11
12
 
12
13
  if (xmlData[i + 3] === 'O' &&
13
14
  xmlData[i + 4] === 'C' &&
@@ -28,11 +29,20 @@ class DocTypeReader {
28
29
  let entityName, val;
29
30
  [entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
30
31
  if (val.indexOf("&") === -1) { //Parameter entities are not supported
31
- const escaped = entityName.replace(/[.\-+*:]/g, '\\.');
32
+ if (this.options.enabled !== false &&
33
+ this.options.maxEntityCount != null &&
34
+ entityCount >= this.options.maxEntityCount) {
35
+ throw new Error(
36
+ `Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
37
+ );
38
+ }
39
+ //const escaped = entityName.replace(/[.\-+*:]/g, '\\.');
40
+ const escaped = entityName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
32
41
  entities[entityName] = {
33
42
  regx: RegExp(`&${escaped};`, "g"),
34
43
  val: val
35
44
  };
45
+ entityCount++;
36
46
  }
37
47
  } else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
38
48
  i += 8; //Not supported
@@ -122,7 +132,7 @@ class DocTypeReader {
122
132
 
123
133
  // Validate entity size
124
134
  if (this.options.enabled !== false &&
125
- this.options.maxEntitySize &&
135
+ this.options.maxEntitySize != null &&
126
136
  entityValue.length > this.options.maxEntitySize) {
127
137
  throw new Error(
128
138
  `Entity "${entityName}" size (${entityValue.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
@@ -1,4 +1,12 @@
1
1
 
2
+ const { DANGEROUS_PROPERTY_NAMES, criticalProperties } = require("../util");
3
+
4
+ const defaultOnDangerousProperty = (name) => {
5
+ if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
6
+ return "__" + name;
7
+ }
8
+ return name;
9
+ };
2
10
  const defaultOptions = {
3
11
  preserveOrder: false,
4
12
  attributeNamePrefix: '@_',
@@ -41,7 +49,32 @@ const defaultOptions = {
41
49
  captureMetaData: false,
42
50
  maxNestedTags: 100,
43
51
  strictReservedNames: true,
52
+ onDangerousProperty: defaultOnDangerousProperty
44
53
  };
54
+ /**
55
+ * Validates that a property name is safe to use
56
+ * @param {string} propertyName - The property name to validate
57
+ * @param {string} optionName - The option field name (for error message)
58
+ * @throws {Error} If property name is dangerous
59
+ */
60
+ function validatePropertyName(propertyName, optionName) {
61
+ if (typeof propertyName !== 'string') {
62
+ return; // Only validate string property names
63
+ }
64
+
65
+ const normalized = propertyName.toLowerCase();
66
+ if (DANGEROUS_PROPERTY_NAMES.some(dangerous => normalized === dangerous.toLowerCase())) {
67
+ throw new Error(
68
+ `[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
69
+ );
70
+ }
71
+
72
+ if (criticalProperties.some(dangerous => normalized === dangerous.toLowerCase())) {
73
+ throw new Error(
74
+ `[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
75
+ );
76
+ }
77
+ }
45
78
 
46
79
  /**
47
80
  * Normalizes processEntities option for backward compatibility
@@ -65,11 +98,12 @@ function normalizeProcessEntities(value) {
65
98
  // Object config - merge with defaults
66
99
  if (typeof value === 'object' && value !== null) {
67
100
  return {
68
- enabled: value.enabled !== false, // default true if not specified
69
- maxEntitySize: value.maxEntitySize ?? 10000,
70
- maxExpansionDepth: value.maxExpansionDepth ?? 10,
71
- maxTotalExpansions: value.maxTotalExpansions ?? 1000,
72
- maxExpandedLength: value.maxExpandedLength ?? 100000,
101
+ enabled: value.enabled !== false,
102
+ maxEntitySize: Math.max(1, value.maxEntitySize ?? 10000),
103
+ maxExpansionDepth: Math.max(1, value.maxExpansionDepth ?? 10000),
104
+ maxTotalExpansions: Math.max(1, value.maxTotalExpansions ?? Infinity),
105
+ maxExpandedLength: Math.max(1, value.maxExpandedLength ?? 100000),
106
+ maxEntityCount: Math.max(1, value.maxEntityCount ?? 1000),
73
107
  allowedTags: value.allowedTags ?? null,
74
108
  tagFilter: value.tagFilter ?? null
75
109
  };
@@ -82,6 +116,26 @@ function normalizeProcessEntities(value) {
82
116
  const buildOptions = function (options) {
83
117
  const built = Object.assign({}, defaultOptions, options);
84
118
 
119
+
120
+ // Validate property names to prevent prototype pollution
121
+ const propertyNameOptions = [
122
+ { value: built.attributeNamePrefix, name: 'attributeNamePrefix' },
123
+ { value: built.attributesGroupName, name: 'attributesGroupName' },
124
+ { value: built.textNodeName, name: 'textNodeName' },
125
+ { value: built.cdataPropName, name: 'cdataPropName' },
126
+ { value: built.commentPropName, name: 'commentPropName' }
127
+ ];
128
+
129
+ for (const { value, name } of propertyNameOptions) {
130
+ if (value) {
131
+ validatePropertyName(value, name);
132
+ }
133
+ }
134
+
135
+ if (built.onDangerousProperty === null) {
136
+ built.onDangerousProperty = defaultOnDangerousProperty;
137
+ }
138
+
85
139
  // Always normalize processEntities for backward compatibility and validation
86
140
  built.processEntities = normalizeProcessEntities(built.processEntities);
87
141
  //console.debug(built.processEntities)
@@ -162,7 +162,7 @@ function buildAttributesMap(attrStr, jPath, tagName) {
162
162
  if (this.options.transformAttributeName) {
163
163
  aName = this.options.transformAttributeName(aName);
164
164
  }
165
- if (aName === "__proto__") aName = "#__proto__";
165
+ aName = sanitizeName(aName, this.options);
166
166
  if (oldVal !== undefined) {
167
167
  if (this.options.trimValues) {
168
168
  oldVal = oldVal.trim();
@@ -325,6 +325,8 @@ const parseXml = function (xmlData) {
325
325
  if (this.options.strictReservedNames &&
326
326
  (tagName === this.options.commentPropName
327
327
  || tagName === this.options.cdataPropName
328
+ || tagName === this.options.textNodeName
329
+ || tagName === this.options.attributesGroupName
328
330
  )) {
329
331
  throw new Error(`Invalid tag name: ${tagName}`);
330
332
  }
@@ -523,16 +525,37 @@ const replaceEntitiesValue = function (val, tagName, jPath) {
523
525
  if (val.indexOf('&') === -1) return val; // Early exit
524
526
 
525
527
  // Replace standard entities
526
- for (let entityName in this.lastEntities) {
528
+ for (const entityName of Object.keys(this.lastEntities)) {
527
529
  const entity = this.lastEntities[entityName];
530
+ const matches = val.match(entity.regex);
531
+ if (matches) {
532
+ this.entityExpansionCount += matches.length;
533
+ if (entityConfig.maxTotalExpansions &&
534
+ this.entityExpansionCount > entityConfig.maxTotalExpansions) {
535
+ throw new Error(
536
+ `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
537
+ );
538
+ }
539
+ }
528
540
  val = val.replace(entity.regex, entity.val);
529
541
  }
530
542
  if (val.indexOf('&') === -1) return val; // Early exit
531
543
 
532
544
  // Replace HTML entities if enabled
533
545
  if (this.options.htmlEntities) {
534
- for (let entityName in this.htmlEntities) {
546
+ for (const entityName of Object.keys(this.htmlEntities)) {
535
547
  const entity = this.htmlEntities[entityName];
548
+ const matches = val.match(entity.regex);
549
+ if (matches) {
550
+ //console.log(matches);
551
+ this.entityExpansionCount += matches.length;
552
+ if (entityConfig.maxTotalExpansions &&
553
+ this.entityExpansionCount > entityConfig.maxTotalExpansions) {
554
+ throw new Error(
555
+ `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
556
+ );
557
+ }
558
+ }
536
559
  val = val.replace(entity.regex, entity.val);
537
560
  }
538
561
  }
@@ -725,4 +748,14 @@ function fromCodePoint(str, base, prefix) {
725
748
  }
726
749
  }
727
750
 
751
+ function sanitizeName(name, options) {
752
+ if (util.criticalProperties.includes(name)) {
753
+ throw new Error(`[SECURITY] Invalid name: "${name}" is a reserved JavaScript keyword that could cause prototype pollution`);
754
+ } else if (util.DANGEROUS_PROPERTY_NAMES.includes(name)) {
755
+ return options.onDangerousProperty(name);
756
+ }
757
+ return name;
758
+ }
759
+
728
760
  module.exports = OrderedObjParser;
761
+
package/test_output.txt DELETED
@@ -1,21 +0,0 @@
1
- Error: While loading /home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js: SyntaxError: The requested module './OutputBuilders/JsObjBuilder.js' does not provide an export named 'JsObjOutputBuilder'
2
- at fixupImportException (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/loader.js:152:12)
3
- at /home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/loader.js:31:37
4
- at async Jasmine._loadFiles (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:142:7)
5
- ... 5 lines matching cause stack trace ...
6
- at async Command.run (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/command.js:72:9) {
7
- [cause]: file:///home/amit/code/git/temp/fast-xml-parser/src/v6/OptionsBuilder.js:2
8
- import {JsObjOutputBuilder} from './OutputBuilders/JsObjBuilder.js';
9
- ^^^^^^^^^^^^^^^^^^
10
- SyntaxError: The requested module './OutputBuilders/JsObjBuilder.js' does not provide an export named 'JsObjOutputBuilder'
11
- at ModuleJob._instantiate (node:internal/modules/esm/module_job:180:21)
12
- at async ModuleJob.run (node:internal/modules/esm/module_job:263:5)
13
- at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:578:26)
14
- at async Jasmine._loadFiles (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:142:7)
15
- at async Jasmine.loadSpecs (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:133:5)
16
- at async /home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:223:9
17
- at async Jasmine.withinGlobalSetup_ (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/runner_base.js:420:7)
18
- at async Jasmine.execute (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:222:7)
19
- at async runJasmine (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/command.js:209:5)
20
- at async Command.run (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/command.js:72:9)
21
- }
package/test_output_2.txt DELETED
@@ -1,21 +0,0 @@
1
- Error: While loading /home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js: SyntaxError: The requested module './TagPath.js' does not provide an export named 'TagPath'
2
- at fixupImportException (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/loader.js:152:12)
3
- at /home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/loader.js:31:37
4
- at async Jasmine._loadFiles (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:142:7)
5
- ... 5 lines matching cause stack trace ...
6
- at async Command.run (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/command.js:72:9) {
7
- [cause]: file:///home/amit/code/git/temp/fast-xml-parser/src/v6/TagPathMatcher.js:1
8
- import {TagPath} from './TagPath.js';
9
- ^^^^^^^
10
- SyntaxError: The requested module './TagPath.js' does not provide an export named 'TagPath'
11
- at ModuleJob._instantiate (node:internal/modules/esm/module_job:180:21)
12
- at async ModuleJob.run (node:internal/modules/esm/module_job:263:5)
13
- at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:578:26)
14
- at async Jasmine._loadFiles (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:142:7)
15
- at async Jasmine.loadSpecs (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:133:5)
16
- at async /home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:223:9
17
- at async Jasmine.withinGlobalSetup_ (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/runner_base.js:420:7)
18
- at async Jasmine.execute (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:222:7)
19
- at async runJasmine (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/command.js:209:5)
20
- at async Command.run (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/command.js:72:9)
21
- }
package/test_output_3.txt DELETED
@@ -1,11 +0,0 @@
1
- TypeError: Cannot read properties of undefined (reading 'preserveOrder')
2
- at buildOptions (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js:53:12)
3
- at new OutputBuilder (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js:7:22)
4
- at file:///home/amit/code/git/temp/fast-xml-parser/src/v6/OptionsBuilder.js:35:18
5
- at ModuleJob.run (node:internal/modules/esm/module_job:271:25)
6
- at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:578:26)
7
- at async Jasmine._loadFiles (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:142:7)
8
- at async Jasmine.loadSpecs (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:133:5)
9
- at async /home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:223:9
10
- at async Jasmine.withinGlobalSetup_ (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/runner_base.js:420:7)
11
- at async Jasmine.execute (/home/amit/code/git/temp/fast-xml-parser/node_modules/jasmine/lib/jasmine.js:222:7)
package/test_output_4.txt DELETED
@@ -1,26 +0,0 @@
1
- Randomized with seed 20147
2
- Started
3
- ..F.F
4
-
5
- Failures:
6
- 1) XMLParser v6 should parse only true numbers
7
- Message:
8
- Expected $.rootNode.intTag = 45 to equal '045'.
9
- Stack:
10
- at <Jasmine>
11
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:63:20)
12
- at <Jasmine>
13
-
14
- 2) XMLParser v6 should not parse values to primitive type
15
- Message:
16
- Expected $.rootNode.boolean = true to equal 'true'.
17
- Expected $.rootNode.intTag = 45 to equal '045'.
18
- Expected $.rootNode.floatTag = 65.34 to equal '65.34'.
19
- Stack:
20
- at <Jasmine>
21
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:120:20)
22
- at <Jasmine>
23
-
24
- 5 specs, 2 failures
25
- Finished in 0.016 seconds
26
- Randomized with seed 20147 (jasmine --random=true --seed=20147)
package/test_output_5.txt DELETED
@@ -1,17 +0,0 @@
1
- Randomized with seed 74872
2
- Started
3
- ..F..
4
-
5
- Failures:
6
- 1) XMLParser v6 should parse all values as string, int, boolean, float, hexadecimal
7
- Message:
8
- Expected $.rootNode.boolean = 'true' to equal true.
9
- Expected $.rootNode.intTag = '045' to equal 45.
10
- Stack:
11
- at <Jasmine>
12
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:28:20)
13
- at <Jasmine>
14
-
15
- 5 specs, 1 failure
16
- Finished in 0.014 seconds
17
- Randomized with seed 74872 (jasmine --random=true --seed=74872)
package/test_output_6.txt DELETED
@@ -1,98 +0,0 @@
1
- Randomized with seed 51104
2
- Started
3
- TagName: tag ValueParsers: [
4
- 'trim', 'join',
5
- 'number', 'boolean',
6
- 'currency', 'trim',
7
- 'number', 'boolean',
8
- 'currency'
9
- ]
10
- TagName: boolean ValueParsers: [
11
- 'trim', 'join',
12
- 'number', 'boolean',
13
- 'currency', 'trim',
14
- 'number', 'boolean',
15
- 'currency'
16
- ]
17
- TagName: intTag ValueParsers: [
18
- 'trim', 'join',
19
- 'number', 'boolean',
20
- 'currency', 'trim',
21
- 'number', 'boolean',
22
- 'currency'
23
- ]
24
- TagName: floatTag ValueParsers: [
25
- 'trim', 'join',
26
- 'number', 'boolean',
27
- 'currency', 'trim',
28
- 'number', 'boolean',
29
- 'currency'
30
- ]
31
- TagName: hexadecimal ValueParsers: [
32
- 'trim', 'join',
33
- 'number', 'boolean',
34
- 'currency', 'trim',
35
- 'number', 'boolean',
36
- 'currency'
37
- ]
38
- TagName: rootNode ValueParsers: [
39
- 'trim', 'join',
40
- 'number', 'boolean',
41
- 'currency', 'trim',
42
- 'number', 'boolean',
43
- 'currency'
44
- ]
45
- .TagName: tag ValueParsers: []
46
- TagName: boolean ValueParsers: []
47
- TagName: intTag ValueParsers: []
48
- TagName: floatTag ValueParsers: []
49
- TagName: rootNode ValueParsers: []
50
- .TagName: tag ValueParsers: []
51
- TagName: rootNode ValueParsers: []
52
- .TagName: floatTag0 ValueParsers: [ numParser { options: { leadingZeros: false } } ]
53
- TagName: floatTag1 ValueParsers: [ numParser { options: { leadingZeros: false } } ]
54
- TagName: floatTag2 ValueParsers: [ numParser { options: { leadingZeros: false } } ]
55
- TagName: floatTag3 ValueParsers: [ numParser { options: { leadingZeros: false } } ]
56
- TagName: rootNode ValueParsers: [ numParser { options: { leadingZeros: false } } ]
57
- .TagName: tag ValueParsers: [
58
- 'boolean',
59
- numParser {
60
- options: { hex: true, leadingZeros: false, eNotation: true }
61
- }
62
- ]
63
- TagName: boolean ValueParsers: [
64
- 'boolean',
65
- numParser {
66
- options: { hex: true, leadingZeros: false, eNotation: true }
67
- }
68
- ]
69
- TagName: intTag ValueParsers: [
70
- 'boolean',
71
- numParser {
72
- options: { hex: true, leadingZeros: false, eNotation: true }
73
- }
74
- ]
75
- TagName: floatTag ValueParsers: [
76
- 'boolean',
77
- numParser {
78
- options: { hex: true, leadingZeros: false, eNotation: true }
79
- }
80
- ]
81
- TagName: long ValueParsers: [
82
- 'boolean',
83
- numParser {
84
- options: { hex: true, leadingZeros: false, eNotation: true }
85
- }
86
- ]
87
- TagName: rootNode ValueParsers: [
88
- 'boolean',
89
- numParser {
90
- options: { hex: true, leadingZeros: false, eNotation: true }
91
- }
92
- ]
93
- .
94
-
95
-
96
- 5 specs, 0 failures
97
- Finished in 0.015 seconds
98
- Randomized with seed 51104 (jasmine --random=true --seed=51104)
package/test_output_7.txt DELETED
@@ -1,48 +0,0 @@
1
- Randomized with seed 51667
2
- Started
3
- ......FFF.F
4
-
5
- Failures:
6
- 1) XMLParser v6 should skip tag arguments
7
- Message:
8
- Expected $.rootNode.intTag = '45' to equal 45.
9
- Expected $.rootNode.floatTag = '65.34' to equal 65.34.
10
- Stack:
11
- at <Jasmine>
12
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:165:20)
13
- at <Jasmine>
14
-
15
- 2) XMLParser v6 should ignore namespace and text node attributes
16
- Message:
17
- Expected object to have properties
18
- node: Object({ tag: Object({ @_arg: 'value', #text: 'value' }), intTag: Object({ @_arg: 'value', @_arg2: 'value2', #text: 45 }), floatTag: 65.34, nsTag: Object({ @_attr: 'tns' }), nsTagNoAttr: '' })
19
- Expected object not to have properties
20
- root:node: Object({ tag: Object({ @_ns:arg: 'value', #text: 'value' }), intTag: Object({ @_ns:arg: 'value', @_ns:arg2: 'value2', #text: '45' }), floatTag: '65.34', nsTag: Object({ @_xmlns:tns-ns: 'urn:none', @_tns-ns:attr: 'tns' }), nsTagNoAttr: Object({ @_xmlns:tns-ns: 'urn:none' }) })
21
- Stack:
22
- at <Jasmine>
23
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:207:20)
24
- at <Jasmine>
25
-
26
- 3) XMLParser v6 should parse all values as string, int, boolean, float, hexadecimal
27
- Message:
28
- Expected $.rootNode.boolean = 'true' to equal true.
29
- Expected $.rootNode.intTag = '045' to equal 45.
30
- Expected $.rootNode.floatTag = '65.34' to equal 65.34.
31
- Expected $.rootNode.hexadecimal = '0x15' to equal 21.
32
- Stack:
33
- at <Jasmine>
34
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:28:20)
35
- at <Jasmine>
36
-
37
- 4) XMLParser v6 should parse repeated nodes in array
38
- Message:
39
- Expected $.rootNode.tag[1] = '45' to equal 45.
40
- Expected $.rootNode.tag[2] = '65.34' to equal 65.34.
41
- Stack:
42
- at <Jasmine>
43
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:259:20)
44
- at <Jasmine>
45
-
46
- 11 specs, 4 failures
47
- Finished in 0.023 seconds
48
- Randomized with seed 51667 (jasmine --random=true --seed=51667)
package/test_output_8.txt DELETED
@@ -1,30 +0,0 @@
1
- Randomized with seed 18744
2
- Started
3
- .....FF....
4
-
5
- Failures:
6
- 1) XMLParser v6 should parse nested nodes in nested properties
7
- Message:
8
- Expected $.rootNode.parenttag.tag[1] = '45' to equal 45.
9
- Expected $.rootNode.parenttag.tag[2] = '65.34' to equal 65.34.
10
- Stack:
11
- at <Jasmine>
12
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:281:20)
13
- at <Jasmine>
14
-
15
- 2) XMLParser v6 should ignore namespace and text node attributes
16
- Message:
17
- ReferenceError: reportError is not defined
18
- Stack:
19
- at resolveNameSpace (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/Xml2JsParser.js:232:12)
20
- at Xml2JsParser.processTagName (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/Xml2JsParser.js:185:12)
21
- at Xml2JsParser.readClosingTag (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/Xml2JsParser.js:87:26)
22
- at Xml2JsParser.parseXml (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/Xml2JsParser.js:69:16)
23
- at Xml2JsParser.parse (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/Xml2JsParser.js:35:10)
24
- at XMLParser.parse (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/XMLParser.js:34:23)
25
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:205:25)
26
- at <Jasmine>
27
-
28
- 11 specs, 2 failures
29
- Finished in 0.02 seconds
30
- Randomized with seed 18744 (jasmine --random=true --seed=18744)
package/test_output_9.txt DELETED
@@ -1,41 +0,0 @@
1
- Randomized with seed 42237
2
- Started
3
- .F.....FF..
4
-
5
- Failures:
6
- 1) XMLParser v6 should ignore namespace and text node attributes
7
- Message:
8
- Error: Multiple namespaces tag
9
- Stack:
10
- at resolveNameSpace (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/Xml2JsParser.js:232:18)
11
- at Xml2JsParser.processTagName (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/Xml2JsParser.js:185:12)
12
- at Xml2JsParser.readClosingTag (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/Xml2JsParser.js:87:26)
13
- at Xml2JsParser.parseXml (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/Xml2JsParser.js:69:16)
14
- at Xml2JsParser.parse (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/Xml2JsParser.js:35:10)
15
- at XMLParser.parse (file:///home/amit/code/git/temp/fast-xml-parser/src/v6/XMLParser.js:34:23)
16
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:205:25)
17
- at <Jasmine>
18
-
19
- 2) XMLParser v6 should parse all values as string, int, boolean, float, hexadecimal
20
- Message:
21
- Expected $.rootNode.boolean = 'true' to equal true.
22
- Expected $.rootNode.intTag = '045' to equal 45.
23
- Expected $.rootNode.floatTag = '65.34' to equal 65.34.
24
- Expected $.rootNode.hexadecimal = '0x15' to equal 21.
25
- Stack:
26
- at <Jasmine>
27
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:28:20)
28
- at <Jasmine>
29
-
30
- 3) XMLParser v6 should parse nested nodes in nested properties
31
- Message:
32
- Expected $.rootNode.parenttag.tag[1] = '45' to equal 45.
33
- Expected $.rootNode.parenttag.tag[2] = '65.34' to equal 65.34.
34
- Stack:
35
- at <Jasmine>
36
- at UserContext.<anonymous> (file:///home/amit/code/git/temp/fast-xml-parser/spec/v6/xmlParser_spec.js:281:20)
37
- at <Jasmine>
38
-
39
- 11 specs, 3 failures
40
- Finished in 0.02 seconds
41
- Randomized with seed 42237 (jasmine --random=true --seed=42237)