fast-xml-parser 4.3.6 → 4.4.1

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/CHANGELOG.md CHANGED
@@ -1,209 +1,219 @@
1
- Note: If you find missing information about particular minor version, that version must have been changed without any functional change in this library.
1
+ <small>Note: If you find missing information about particular minor version, that version must have been changed without any functional change in this library.</small>
2
+
3
+ **4.4.1 / 2024-07-28**
4
+ - v5 fix: maximum length limit to currency value
5
+ - fix #634: build attributes with oneListGroup and attributesGroupName (#653)(By [Andreas Naziris](https://github.com/a-rasin))
6
+ - fix: get oneListGroup to work as expected for array of strings (#662)(By [Andreas Naziris](https://github.com/a-rasin))
7
+
8
+ **4.4.0 / 2024-05-18**
9
+ - fix #654: parse attribute list correctly for self closing stop node.
10
+ - fix: validator bug when closing tag is not opened. (#647) (By [Ryosuke Fukatani](https://github.com/RyosukeFukatani))
11
+ - fix #581: typings; return type of `tagValueProcessor` & `attributeValueProcessor` (#582) (By [monholm]())
2
12
 
3
13
  **4.3.6 / 2024-03-16**
4
- * Add support for parsing HTML numeric entities (#645) (By [Jonas Schade ](https://github.com/DerZade))
14
+ - Add support for parsing HTML numeric entities (#645) (By [Jonas Schade ](https://github.com/DerZade))
5
15
 
6
16
  **4.3.5 / 2024-02-24**
7
- * code for v5 is added for experimental use
17
+ - code for v5 is added for experimental use
8
18
 
9
19
  **4.3.4 / 2024-01-10**
10
- * fix: Don't escape entities in CDATA sections (#633) (By [wackbyte](https://github.com/wackbyte))
20
+ - fix: Don't escape entities in CDATA sections (#633) (By [wackbyte](https://github.com/wackbyte))
11
21
 
12
22
  **4.3.3 / 2024-01-10**
13
- * Remove unnecessary regex
23
+ - Remove unnecessary regex
14
24
 
15
25
  **4.3.2 / 2023-10-02**
16
- * fix `jObj.hasOwnProperty` when give input is null (By [Arda TANRIKULU](https://github.com/ardatan))
26
+ - fix `jObj.hasOwnProperty` when give input is null (By [Arda TANRIKULU](https://github.com/ardatan))
17
27
 
18
28
  **4.3.1 / 2023-09-24**
19
- * revert back "Fix typings for builder and parser to make return type generic" to avoid failure of existing projects. Need to decide a common approach.
29
+ - revert back "Fix typings for builder and parser to make return type generic" to avoid failure of existing projects. Need to decide a common approach.
20
30
 
21
31
  **4.3.0 / 2023-09-20**
22
- * Fix stopNodes to work with removeNSPrefix (#607) (#608) (By [Craig Andrews]https://github.com/candrews))
23
- * Fix #610 ignore properties set to Object.prototype
24
- * Fix typings for builder and parser to make return type generic (By [Sarah Dayan](https://github.com/sarahdayan))
32
+ - Fix stopNodes to work with removeNSPrefix (#607) (#608) (By [Craig Andrews]https://github.com/candrews))
33
+ - Fix #610 ignore properties set to Object.prototype
34
+ - Fix typings for builder and parser to make return type generic (By [Sarah Dayan](https://github.com/sarahdayan))
25
35
 
26
36
  **4.2.7 / 2023-07-30**
27
- * Fix: builder should set text node correctly when only textnode is present (#589) (By [qianqing](https://github.com/joneqian))
28
- * Fix: Fix for null and undefined attributes when building xml (#585) (#598). A null or undefined value should be ignored. (By [Eugenio Ceschia](https://github.com/cecia234))
37
+ - Fix: builder should set text node correctly when only textnode is present (#589) (By [qianqing](https://github.com/joneqian))
38
+ - Fix: Fix for null and undefined attributes when building xml (#585) (#598). A null or undefined value should be ignored. (By [Eugenio Ceschia](https://github.com/cecia234))
29
39
 
30
40
  **4.2.6 / 2023-07-17**
31
- * Fix: Remove trailing slash from jPath for self-closing tags (#595) (By [Maciej Radzikowski](https://github.com/m-radzikowski))
41
+ - Fix: Remove trailing slash from jPath for self-closing tags (#595) (By [Maciej Radzikowski](https://github.com/m-radzikowski))
32
42
 
33
43
  **4.2.5 / 2023-06-22**
34
- * change code implementation
44
+ - change code implementation
35
45
 
36
46
  **4.2.4 / 2023-06-06**
37
- * fix security bug
47
+ - fix security bug
38
48
 
39
49
  **4.2.3 / 2023-06-05**
40
- * fix security bug
50
+ - fix security bug
41
51
 
42
52
  **4.2.2 / 2023-04-18**
43
- * fix #562: fix unpaired tag when it comes in last of a nested tag. Also throw error when unpaired tag is used as closing tag
53
+ - fix #562: fix unpaired tag when it comes in last of a nested tag. Also throw error when unpaired tag is used as closing tag
44
54
 
45
55
  **4.2.1 / 2023-04-18**
46
- * fix: jpath after unpaired tags
56
+ - fix: jpath after unpaired tags
47
57
 
48
58
  **4.2.0 / 2023-04-09**
49
- * support `updateTag` parser property
59
+ - support `updateTag` parser property
50
60
 
51
61
  **4.1.4 / 2023-04-08**
52
- * update typings to let user create XMLBuilder instance without options (#556) (By [Patrick](https://github.com/omggga))
53
- * fix: IsArray option isn't parsing tags with 0 as value correctly #490 (#557) (By [Aleksandr Murashkin](https://github.com/p-kuen))
54
- * feature: support `oneListGroup` to group repeated children tags udder single group
62
+ - update typings to let user create XMLBuilder instance without options (#556) (By [Patrick](https://github.com/omggga))
63
+ - fix: IsArray option isn't parsing tags with 0 as value correctly #490 (#557) (By [Aleksandr Murashkin](https://github.com/p-kuen))
64
+ - feature: support `oneListGroup` to group repeated children tags udder single group
55
65
 
56
66
  **4.1.3 / 2023-02-26**
57
- * fix #546: Support complex entity value
67
+ - fix #546: Support complex entity value
58
68
 
59
69
  **4.1.2 / 2023-02-12**
60
- * Security Fix
70
+ - Security Fix
61
71
 
62
72
  **4.1.1 / 2023-02-03**
63
- * Fix #540: ignoreAttributes breaks unpairedTags
64
- * Refactor XML builder code
73
+ - Fix #540: ignoreAttributes breaks unpairedTags
74
+ - Refactor XML builder code
65
75
 
66
76
  **4.1.0 / 2023-02-02**
67
- * Fix '<' or '>' in DTD comment throwing an error. (#533) (By [Adam Baker](https://github.com/Cwazywierdo))
68
- * Set "eNotation" to 'true' as default
77
+ - Fix '<' or '>' in DTD comment throwing an error. (#533) (By [Adam Baker](https://github.com/Cwazywierdo))
78
+ - Set "eNotation" to 'true' as default
69
79
 
70
80
  **4.0.15 / 2023-01-25**
71
- * make "eNotation" optional
81
+ - make "eNotation" optional
72
82
 
73
83
  **4.0.14 / 2023-01-22**
74
- * fixed: add missed typing "eNotation" to parse values
84
+ - fixed: add missed typing "eNotation" to parse values
75
85
 
76
86
  **4.0.13 / 2023-01-07**
77
- * preserveorder formatting (By [mdeknowis](https://github.com/mdeknowis))
78
- * support `transformAttributeName` (By [Erik Rothoff Andersson](https://github.com/erkie))
87
+ - preserveorder formatting (By [mdeknowis](https://github.com/mdeknowis))
88
+ - support `transformAttributeName` (By [Erik Rothoff Andersson](https://github.com/erkie))
79
89
 
80
90
  **4.0.12 / 2022-11-19**
81
- * fix typescript
91
+ - fix typescript
82
92
 
83
93
  **4.0.11 / 2022-10-05**
84
- * fix #501: parse for entities only once
94
+ - fix #501: parse for entities only once
85
95
 
86
96
  **4.0.10 / 2022-09-14**
87
- * fix broken links in demo site (By [Yannick Lang](https://github.com/layaxx))
88
- * fix #491: tagValueProcessor type definition (By [Andrea Francesco Speziale](https://github.com/andreafspeziale))
89
- * Add jsdocs for tagValueProcessor
97
+ - fix broken links in demo site (By [Yannick Lang](https://github.com/layaxx))
98
+ - fix #491: tagValueProcessor type definition (By [Andrea Francesco Speziale](https://github.com/andreafspeziale))
99
+ - Add jsdocs for tagValueProcessor
90
100
 
91
101
 
92
102
  **4.0.9 / 2022-07-10**
93
- * fix #470: stop-tag can have self-closing tag with same name
94
- * fix #472: stopNode can have any special tag inside
95
- * Allow !ATTLIST and !NOTATION with DOCTYPE
96
- * Add transformTagName option to transform tag names when parsing (#469) (By [Erik Rothoff Andersson](https://github.com/erkie))
103
+ - fix #470: stop-tag can have self-closing tag with same name
104
+ - fix #472: stopNode can have any special tag inside
105
+ - Allow !ATTLIST and !NOTATION with DOCTYPE
106
+ - Add transformTagName option to transform tag names when parsing (#469) (By [Erik Rothoff Andersson](https://github.com/erkie))
97
107
 
98
108
  **4.0.8 / 2022-05-28**
99
- * Fix CDATA parsing returning empty string when value = 0 (#451) (By [ndelanou](https://github.com/ndelanou))
100
- * Fix stopNodes when same tag appears inside node (#456) (By [patrickshipe](https://github.com/patrickshipe))
101
- * fix #468: prettify own properties only
109
+ - Fix CDATA parsing returning empty string when value = 0 (#451) (By [ndelanou](https://github.com/ndelanou))
110
+ - Fix stopNodes when same tag appears inside node (#456) (By [patrickshipe](https://github.com/patrickshipe))
111
+ - fix #468: prettify own properties only
102
112
 
103
113
  **4.0.7 / 2022-03-18**
104
- * support CDATA even if tag order is not preserved
105
- * support Comments even if tag order is not preserved
106
- * fix #446: XMLbuilder should not indent XML declaration
114
+ - support CDATA even if tag order is not preserved
115
+ - support Comments even if tag order is not preserved
116
+ - fix #446: XMLbuilder should not indent XML declaration
107
117
 
108
118
  **4.0.6 / 2022-03-08**
109
- * fix: call tagValueProcessor only once for array items
110
- * fix: missing changed for #437
119
+ - fix: call tagValueProcessor only once for array items
120
+ - fix: missing changed for #437
111
121
 
112
122
  **4.0.5 / 2022-03-06**
113
- * fix #437: call tagValueProcessor from XML builder
123
+ - fix #437: call tagValueProcessor from XML builder
114
124
 
115
125
  **4.0.4 / 2022-03-03**
116
- * fix #435: should skip unpaired and self-closing nodes when set as stopnodes
126
+ - fix #435: should skip unpaired and self-closing nodes when set as stopnodes
117
127
 
118
128
  **4.0.3 / 2022-02-15**
119
- * fix: ReferenceError when Bundled with Strict (#431) (By [Andreas Heissenberger](https://github.com/aheissenberger))
129
+ - fix: ReferenceError when Bundled with Strict (#431) (By [Andreas Heissenberger](https://github.com/aheissenberger))
120
130
 
121
131
 
122
132
  **4.0.2 / 2022-02-04**
123
- * builder supports `suppressUnpairedNode`
124
- * parser supports `ignoreDeclaration` and `ignorePiTags`
125
- * fix: when comment is parsed as text value if given as `<!--> ...` #423
126
- * builder supports decoding `&`
133
+ - builder supports `suppressUnpairedNode`
134
+ - parser supports `ignoreDeclaration` and `ignorePiTags`
135
+ - fix: when comment is parsed as text value if given as `<!--> ...` #423
136
+ - builder supports decoding `&`
127
137
 
128
138
  **4.0.1 / 2022-01-08**
129
- * fix builder for pi tag
130
- * fix: support suppressBooleanAttrs by builder
139
+ - fix builder for pi tag
140
+ - fix: support suppressBooleanAttrs by builder
131
141
 
132
142
  **4.0.0 / 2022-01-06**
133
- * Generating different combined, parser only, builder only, validator only browser bundles
134
- * Keeping cjs modules as they can be imported in cjs and esm modules both. Otherwise refer `esm` branch.
143
+ - Generating different combined, parser only, builder only, validator only browser bundles
144
+ - Keeping cjs modules as they can be imported in cjs and esm modules both. Otherwise refer `esm` branch.
135
145
 
136
146
  **4.0.0-beta.8 / 2021-12-13**
137
- * call tagValueProcessor for stop nodes
147
+ - call tagValueProcessor for stop nodes
138
148
 
139
149
  **4.0.0-beta.7 / 2021-12-09**
140
- * fix Validator bug when an attribute has no value but '=' only
141
- * XML Builder should suppress unpaired tags by default.
142
- * documents update for missing features
143
- * refactoring to use Object.assign
144
- * refactoring to remove repeated code
150
+ - fix Validator bug when an attribute has no value but '=' only
151
+ - XML Builder should suppress unpaired tags by default.
152
+ - documents update for missing features
153
+ - refactoring to use Object.assign
154
+ - refactoring to remove repeated code
145
155
 
146
156
  **4.0.0-beta.6 / 2021-12-05**
147
- * Support PI Tags processing
148
- * Support `suppressBooleanAttributes` by XML Builder for attributes with value `true`.
157
+ - Support PI Tags processing
158
+ - Support `suppressBooleanAttributes` by XML Builder for attributes with value `true`.
149
159
 
150
160
  **4.0.0-beta.5 / 2021-12-04**
151
- * fix: when a tag with name "attributes"
161
+ - fix: when a tag with name "attributes"
152
162
 
153
163
  **4.0.0-beta.4 / 2021-12-02**
154
- * Support HTML document parsing
155
- * skip stop nodes parsing when building the XML from JS object
156
- * Support external entites without DOCTYPE
157
- * update dev dependency: strnum v1.0.5 to fix long number issue
164
+ - Support HTML document parsing
165
+ - skip stop nodes parsing when building the XML from JS object
166
+ - Support external entites without DOCTYPE
167
+ - update dev dependency: strnum v1.0.5 to fix long number issue
158
168
 
159
169
  **4.0.0-beta.3 / 2021-11-30**
160
- * support global stopNodes expression like "*.stop"
161
- * support self-closing and paired unpaired tags
162
- * fix: CDATA should not be parsed.
163
- * Fix typings for XMLBuilder (#396)(By [Anders Emil Salvesen](https://github.com/andersem))
164
- * supports XML entities, HTML entities, DOCTYPE entities
170
+ - support global stopNodes expression like "*.stop"
171
+ - support self-closing and paired unpaired tags
172
+ - fix: CDATA should not be parsed.
173
+ - Fix typings for XMLBuilder (#396)(By [Anders Emil Salvesen](https://github.com/andersem))
174
+ - supports XML entities, HTML entities, DOCTYPE entities
165
175
 
166
176
  **⚠️ 4.0.0-beta.2 / 2021-11-19**
167
- * rename `attrMap` to `attibutes` in parser output when `preserveOrder:true`
168
- * supports unpairedTags
177
+ - rename `attrMap` to `attibutes` in parser output when `preserveOrder:true`
178
+ - supports unpairedTags
169
179
 
170
180
  **⚠️ 4.0.0-beta.1 / 2021-11-18**
171
- * Parser returns an array now
172
- * to make the structure common
173
- * and to return root level detail
174
- * renamed `cdataTagName` to `cdataPropName`
175
- * Added `commentPropName`
176
- * fix typings
181
+ - Parser returns an array now
182
+ - to make the structure common
183
+ - and to return root level detail
184
+ - renamed `cdataTagName` to `cdataPropName`
185
+ - Added `commentPropName`
186
+ - fix typings
177
187
 
178
188
  **⚠️ 4.0.0-beta.0 / 2021-11-16**
179
- * Name change of many configuration properties.
180
- * `attrNodeName` to `attributesGroupName`
181
- * `attrValueProcessor` to `attributeValueProcessor`
182
- * `parseNodeValue` to `parseTagValue`
183
- * `ignoreNameSpace` to `removeNSPrefix`
184
- * `numParseOptions` to `numberParseOptions`
185
- * spelling correction for `suppressEmptyNode`
186
- * Name change of cli and browser bundle to **fxparser**
187
- * `isArray` option is added to parse a tag into array
188
- * `preserveOrder` option is added to render XML in such a way that the result js Object maintains the order of properties same as in XML.
189
- * Processing behaviour of `tagValueProcessor` and `attributeValueProcessor` are changes with extra input parameters
190
- * j2xparser is renamed to XMLBuilder.
191
- * You need to build XML parser instance for given options first before parsing XML.
192
- * fix #327, #336: throw error when extra text after XML content
193
- * fix #330: attribute value can have '\n',
194
- * fix #350: attrbiutes can be separated by '\n' from tagname
189
+ - Name change of many configuration properties.
190
+ - `attrNodeName` to `attributesGroupName`
191
+ - `attrValueProcessor` to `attributeValueProcessor`
192
+ - `parseNodeValue` to `parseTagValue`
193
+ - `ignoreNameSpace` to `removeNSPrefix`
194
+ - `numParseOptions` to `numberParseOptions`
195
+ - spelling correction for `suppressEmptyNode`
196
+ - Name change of cli and browser bundle to **fxparser**
197
+ - `isArray` option is added to parse a tag into array
198
+ - `preserveOrder` option is added to render XML in such a way that the result js Object maintains the order of properties same as in XML.
199
+ - Processing behaviour of `tagValueProcessor` and `attributeValueProcessor` are changes with extra input parameters
200
+ - j2xparser is renamed to XMLBuilder.
201
+ - You need to build XML parser instance for given options first before parsing XML.
202
+ - fix #327, #336: throw error when extra text after XML content
203
+ - fix #330: attribute value can have '\n',
204
+ - fix #350: attrbiutes can be separated by '\n' from tagname
195
205
 
196
206
  3.21.1 / 2021-10-31
197
- * Correctly format JSON elements with a text prop but no attribute props ( By [haddadnj](https://github.com/haddadnj) )
207
+ - Correctly format JSON elements with a text prop but no attribute props ( By [haddadnj](https://github.com/haddadnj) )
198
208
 
199
209
  3.21.0 / 2021-10-25
200
- * feat: added option `rootNodeName` to set tag name for array input when converting js object to XML.
201
- * feat: added option `alwaysCreateTextNode` to force text node creation (by: *@massimo-ua*)
202
- * ⚠️ feat: Better error location for unclosed tags. (by *@Gei0r*)
203
- * Some error messages would be changed when validating XML. Eg
204
- * `{ InvalidXml: "Invalid '[ \"rootNode\"]' found." }` → `{InvalidTag: "Unclosed tag 'rootNode'."}`
205
- * `{ InvalidTag: "Closing tag 'rootNode' is expected inplace of 'rootnode'." }` → `{ InvalidTag: "Expected closing tag 'rootNode' (opened in line 1) instead of closing tag 'rootnode'."}`
206
- * ⚠️ feat: Column in error response when validating XML
210
+ - feat: added option `rootNodeName` to set tag name for array input when converting js object to XML.
211
+ - feat: added option `alwaysCreateTextNode` to force text node creation (by: *@massimo-ua*)
212
+ - ⚠️ feat: Better error location for unclosed tags. (by *@Gei0r*)
213
+ - Some error messages would be changed when validating XML. Eg
214
+ - `{ InvalidXml: "Invalid '[ \"rootNode\"]' found." }` → `{InvalidTag: "Unclosed tag 'rootNode'."}`
215
+ - `{ InvalidTag: "Closing tag 'rootNode' is expected inplace of 'rootnode'." }` → `{ InvalidTag: "Expected closing tag 'rootNode' (opened in line 1) instead of closing tag 'rootnode'."}`
216
+ - ⚠️ feat: Column in error response when validating XML
207
217
  ```js
208
218
  {
209
219
  "code": "InvalidAttr",
@@ -214,371 +224,371 @@ Note: If you find missing information about particular minor version, that versi
214
224
  ```
215
225
 
216
226
  3.20.1 / 2021-09-25
217
- * update strnum package
227
+ - update strnum package
218
228
 
219
229
  3.20.0 / 2021-09-10
220
- * Use strnum npm package to parse string to number
221
- * breaking change: long number will be parsed to scientific notation.
230
+ - Use strnum npm package to parse string to number
231
+ - breaking change: long number will be parsed to scientific notation.
222
232
 
223
233
  3.19.0 / 2021-03-14
224
- * License changed to MIT original
225
- * Fix #321 : namespace tag parsing
234
+ - License changed to MIT original
235
+ - Fix #321 : namespace tag parsing
226
236
 
227
237
  3.18.0 / 2021-02-05
228
- * Support RegEx and function in arrayMode option
229
- * Fix #317 : validate nested PI tags
238
+ - Support RegEx and function in arrayMode option
239
+ - Fix #317 : validate nested PI tags
230
240
 
231
241
  3.17.4 / 2020-06-07
232
- * Refactor some code to support IE11
233
- * Fix: `<tag >` space as attribute string
242
+ - Refactor some code to support IE11
243
+ - Fix: `<tag >` space as attribute string
234
244
 
235
245
  3.17.3 / 2020-05-23
236
- * Fix: tag name separated by \n \t
237
- * Fix: throw error for unclosed tags
246
+ - Fix: tag name separated by \n \t
247
+ - Fix: throw error for unclosed tags
238
248
 
239
249
  3.17.2 / 2020-05-23
240
- * Fixed an issue in processing doctype tag
241
- * Fixed tagName where it should not have whitespace chars
250
+ - Fixed an issue in processing doctype tag
251
+ - Fixed tagName where it should not have whitespace chars
242
252
 
243
253
  3.17.1 / 2020-05-19
244
- * Fixed an issue in checking opening tag
254
+ - Fixed an issue in checking opening tag
245
255
 
246
256
  3.17.0 / 2020-05-18
247
- * parser: fix '<' issue when it comes in aatr value
248
- * parser: refactoring to remove dependency from regex
249
- * validator: fix IE 11 issue for error messages
250
- * updated dev dependencies
251
- * separated benchmark module to sub-module
252
- * breaking change: comments will not be removed from CDATA data
257
+ - parser: fix '<' issue when it comes in aatr value
258
+ - parser: refactoring to remove dependency from regex
259
+ - validator: fix IE 11 issue for error messages
260
+ - updated dev dependencies
261
+ - separated benchmark module to sub-module
262
+ - breaking change: comments will not be removed from CDATA data
253
263
 
254
264
  3.16.0 / 2020-01-12
255
- * validaor: fix for ampersand characters (#215)
256
- * refactoring to support unicode chars in tag name
257
- * update typing for validator error
265
+ - validaor: fix for ampersand characters (#215)
266
+ - refactoring to support unicode chars in tag name
267
+ - update typing for validator error
258
268
 
259
269
  3.15.1 / 2019-12-09
260
- * validaor: fix multiple roots are not allowed
270
+ - validaor: fix multiple roots are not allowed
261
271
 
262
272
  3.15.0 / 2019-11-23
263
- * validaor: improve error messaging
264
- * validator: add line number in case of error
265
- * validator: add more error scenarios to make it more descriptive
273
+ - validaor: improve error messaging
274
+ - validator: add line number in case of error
275
+ - validator: add more error scenarios to make it more descriptive
266
276
 
267
277
  3.14.0 / 2019-10-25
268
- * arrayMode for XML to JS obj parsing
278
+ - arrayMode for XML to JS obj parsing
269
279
 
270
280
  3.13.0 / 2019-10-02
271
- * pass tag/attr name to tag/attr value processor
272
- * inbuilt optional validation with XML parser
281
+ - pass tag/attr name to tag/attr value processor
282
+ - inbuilt optional validation with XML parser
273
283
 
274
284
  3.12.21 / 2019-10-02
275
- * Fix validator for unclosed XMLs
276
- * move nimnjs dependency to dev dependency
277
- * update dependencies
285
+ - Fix validator for unclosed XMLs
286
+ - move nimnjs dependency to dev dependency
287
+ - update dependencies
278
288
 
279
289
  3.12.20 / 2019-08-16
280
- * Revert: Fix #167: '>' in attribute value as it is causing high performance degrade.
290
+ - Revert: Fix #167: '>' in attribute value as it is causing high performance degrade.
281
291
 
282
292
  3.12.19 / 2019-07-28
283
- * Fix js to xml parser should work for date values. (broken: `tagValueProcessor` will receive the original value instead of string always) (breaking change)
293
+ - Fix js to xml parser should work for date values. (broken: `tagValueProcessor` will receive the original value instead of string always) (breaking change)
284
294
 
285
295
  3.12.18 / 2019-07-27
286
- * remove configstore dependency
296
+ - remove configstore dependency
287
297
 
288
298
  3.12.17 / 2019-07-14
289
- * Fix #167: '>' in attribute value
299
+ - Fix #167: '>' in attribute value
290
300
 
291
301
  3.12.16 / 2019-03-23
292
- * Support a new option "stopNodes". (#150)
302
+ - Support a new option "stopNodes". (#150)
293
303
  Accept the list of tags which are not required to be parsed. Instead, all the nested tag and data will be assigned as string.
294
- * Don't show post-install message
304
+ - Don't show post-install message
295
305
 
296
306
  3.12.12 / 2019-01-11
297
- * fix : IE parseInt, parseFloat error
307
+ - fix : IE parseInt, parseFloat error
298
308
 
299
309
  3.12.11 / 2018-12-24
300
- * fix #132: "/" should not be parsed as boolean attr in case of self closing tags
310
+ - fix #132: "/" should not be parsed as boolean attr in case of self closing tags
301
311
 
302
312
  3.12.9 / 2018-11-23
303
- * fix #129 : validator should not fail when an atrribute name is 'length'
313
+ - fix #129 : validator should not fail when an atrribute name is 'length'
304
314
 
305
315
  3.12.8 / 2018-11-22
306
- * fix #128 : use 'attrValueProcessor' to process attribute value in json2xml parser
316
+ - fix #128 : use 'attrValueProcessor' to process attribute value in json2xml parser
307
317
 
308
318
  3.12.6 / 2018-11-10
309
- * Fix #126: check for type
319
+ - Fix #126: check for type
310
320
 
311
321
  3.12.4 / 2018-09-12
312
- * Fix: include tasks in npm package
322
+ - Fix: include tasks in npm package
313
323
 
314
324
  3.12.3 / 2018-09-12
315
- * Fix CLI issue raised in last PR
325
+ - Fix CLI issue raised in last PR
316
326
 
317
327
  3.12.2 / 2018-09-11
318
- * Fix formatting for JSON to XML output
319
- * Migrate to webpack (PR merged)
320
- * fix cli (PR merged)
328
+ - Fix formatting for JSON to XML output
329
+ - Migrate to webpack (PR merged)
330
+ - fix cli (PR merged)
321
331
 
322
332
  3.12.0 / 2018-08-06
323
- * Support hexadecimal values
324
- * Support true number parsing
333
+ - Support hexadecimal values
334
+ - Support true number parsing
325
335
 
326
336
  3.11.2 / 2018-07-23
327
- * Update Demo for more options
328
- * Update license information
329
- * Update readme for formatting, users, and spelling mistakes
330
- * Add missing typescript definition for j2xParser
331
- * refactoring: change filenames
337
+ - Update Demo for more options
338
+ - Update license information
339
+ - Update readme for formatting, users, and spelling mistakes
340
+ - Add missing typescript definition for j2xParser
341
+ - refactoring: change filenames
332
342
 
333
343
  3.11.1 / 2018-06-05
334
- * fix #93: read the text after self closing tag
344
+ - fix #93: read the text after self closing tag
335
345
 
336
346
  3.11.0 / 2018-05-20
337
- * return defaultOptions if there are not options in buildOptions function
338
- * added localeRange declaration in parser.d.ts
339
- * Added support of cyrillic characters in validator XML
340
- * fixed bug in validator work when XML data with byte order marker
347
+ - return defaultOptions if there are not options in buildOptions function
348
+ - added localeRange declaration in parser.d.ts
349
+ - Added support of cyrillic characters in validator XML
350
+ - fixed bug in validator work when XML data with byte order marker
341
351
 
342
352
  3.10.0 / 2018-05-13
343
- * Added support of cyrillic characters in parsing XML to JSON
353
+ - Added support of cyrillic characters in parsing XML to JSON
344
354
 
345
355
  3.9.11 / 2018-05-09
346
- * fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/80 fix nimn chars
347
- * update package information
348
- * fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/86: json 2 xml parser : property with null value should be parsed to self closing tag.
349
- * update online demo
350
- * revert zombiejs to old version to support old version of node
351
- * update dependencies
356
+ - fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/80 fix nimn chars
357
+ - update package information
358
+ - fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/86: json 2 xml parser : property with null value should be parsed to self closing tag.
359
+ - update online demo
360
+ - revert zombiejs to old version to support old version of node
361
+ - update dependencies
352
362
 
353
363
  3.3.10 / 2018-04-23
354
- * fix #77 : parse even if closing tag has space before '>'
355
- * include all css & js lib in demo app
356
- * remove babel dependencies until needed
364
+ - fix #77 : parse even if closing tag has space before '>'
365
+ - include all css & js lib in demo app
366
+ - remove babel dependencies until needed
357
367
 
358
368
  3.3.9 / 2018-04-18
359
- * fix #74 : TS2314 TypeScript compiler error
369
+ - fix #74 : TS2314 TypeScript compiler error
360
370
 
361
371
  3.3.8 / 2018-04-17
362
- * fix #73 : IE doesn't support Object.assign
372
+ - fix #73 : IE doesn't support Object.assign
363
373
 
364
374
  3.3.7 / 2018-04-14
365
- * fix: use let insted of const in for loop of validator
366
- * Merge pull request
375
+ - fix: use let insted of const in for loop of validator
376
+ - Merge pull request
367
377
  https://github.com/NaturalIntelligence/fast-xml-parser/issues/71 from bb/master
368
378
  first draft of typings for typescript
369
379
  https://github.com/NaturalIntelligence/fast-xml-parser/issues/69
370
- * Merge pull request
380
+ - Merge pull request
371
381
  https://github.com/NaturalIntelligence/fast-xml-parser/issues/70 from bb/patch-1
372
382
  fix some typos in readme
373
383
 
374
384
  3.3.6 / 2018-03-21
375
- * change arrow functions to full notation for IE compatibility
385
+ - change arrow functions to full notation for IE compatibility
376
386
 
377
387
  3.3.5 / 2018-03-15
378
- * fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/67 : attrNodeName invalid behavior
379
- * fix: remove decodeHTML char condition
388
+ - fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/67 : attrNodeName invalid behavior
389
+ - fix: remove decodeHTML char condition
380
390
 
381
391
  3.3.4 / 2018-03-14
382
- * remove dependency on "he" package
383
- * refactor code to separate methods in separate files.
384
- * draft code for transforming XML to json string. It is not officially documented due to performance issue.
392
+ - remove dependency on "he" package
393
+ - refactor code to separate methods in separate files.
394
+ - draft code for transforming XML to json string. It is not officially documented due to performance issue.
385
395
 
386
396
  3.3.0 / 2018-03-05
387
- * use common default options for XML parsing for consistency. And add `parseToNimn` method.
388
- * update nexttodo
389
- * update README about XML to Nimn transformation and remove special notes about 3.x release
390
- * update CONTRIBUTING.ms mentioning nexttodo
391
- * add negative case for XML PIs
392
- * validate xml processing instruction tags https://github.com/NaturalIntelligence/fast-xml-parser/issues/62
393
- * nimndata: handle array with object
394
- * nimndata: node with nested node and text node
395
- * nimndata: handle attributes and text node
396
- * nimndata: add options, handle array
397
- * add xml to nimn data converter
398
- * x2j: direct access property with tagname
399
- * update changelog
400
- * fix validator when single quote presents in value enclosed with double quotes or vice versa
401
- * Revert "remove unneded nimnjs dependency, move opencollective to devDependencies and replace it
397
+ - use common default options for XML parsing for consistency. And add `parseToNimn` method.
398
+ - update nexttodo
399
+ - update README about XML to Nimn transformation and remove special notes about 3.x release
400
+ - update CONTRIBUTING.ms mentioning nexttodo
401
+ - add negative case for XML PIs
402
+ - validate xml processing instruction tags https://github.com/NaturalIntelligence/fast-xml-parser/issues/62
403
+ - nimndata: handle array with object
404
+ - nimndata: node with nested node and text node
405
+ - nimndata: handle attributes and text node
406
+ - nimndata: add options, handle array
407
+ - add xml to nimn data converter
408
+ - x2j: direct access property with tagname
409
+ - update changelog
410
+ - fix validator when single quote presents in value enclosed with double quotes or vice versa
411
+ - Revert "remove unneded nimnjs dependency, move opencollective to devDependencies and replace it
402
412
  with more light opencollective-postinstall"
403
413
  This reverts commit d47aa7181075d82db4fee97fd8ea32b056fe3f46.
404
- * Merge pull request: https://github.com/NaturalIntelligence/fast-xml-parser/issues/63 from HaroldPutman/suppress-undefined
414
+ - Merge pull request: https://github.com/NaturalIntelligence/fast-xml-parser/issues/63 from HaroldPutman/suppress-undefined
405
415
  Keep undefined nodes out of the XML output : This is useful when you are deleting nodes from the JSON and rewriting XML.
406
416
 
407
417
  3.2.4 / 2018-03-01
408
- * fix #59 fix in validator when open quote presents in attribute value
409
- * Create nexttodo.md
410
- * exclude static from bitHound tests
411
- * add package lock
418
+ - fix #59 fix in validator when open quote presents in attribute value
419
+ - Create nexttodo.md
420
+ - exclude static from bitHound tests
421
+ - add package lock
412
422
 
413
423
  3.2.3 / 2018-02-28
414
- * Merge pull request from Delagen/master: fix namespaces can contain the same characters as xml names
424
+ - Merge pull request from Delagen/master: fix namespaces can contain the same characters as xml names
415
425
 
416
426
  3.2.2 / 2018-02-22
417
- * fix: attribute xmlns should not be removed if ignoreNameSpace is false
418
- * create CONTRIBUTING.md
427
+ - fix: attribute xmlns should not be removed if ignoreNameSpace is false
428
+ - create CONTRIBUTING.md
419
429
 
420
430
  3.2.1 / 2018-02-17
421
- * fix: empty attribute should be parsed
431
+ - fix: empty attribute should be parsed
422
432
 
423
433
  3.2.0 / 2018-02-16
424
- * Merge pull request : Dev to Master
425
- * Update README and version
426
- * j2x:add performance test
427
- * j2x: Remove extra empty line before closing tag
428
- * j2x: suppress empty nodes to self closing node if configured
429
- * j2x: provide option to give indentation depth
430
- * j2x: make optional formatting
431
- * j2x: encodeHTMLchat
432
- * j2x: handle cdata tag
433
- * j2x: handle grouped attributes
434
- * convert json to xml
434
+ - Merge pull request : Dev to Master
435
+ - Update README and version
436
+ - j2x:add performance test
437
+ - j2x: Remove extra empty line before closing tag
438
+ - j2x: suppress empty nodes to self closing node if configured
439
+ - j2x: provide option to give indentation depth
440
+ - j2x: make optional formatting
441
+ - j2x: encodeHTMLchat
442
+ - j2x: handle cdata tag
443
+ - j2x: handle grouped attributes
444
+ - convert json to xml
435
445
  - nested object
436
446
  - array
437
447
  - attributes
438
448
  - text value
439
- * small refactoring
440
- * Merge pull request: Update cli.js to let user validate XML file or data
441
- * Add option for rendering CDATA as separate property
449
+ - small refactoring
450
+ - Merge pull request: Update cli.js to let user validate XML file or data
451
+ - Add option for rendering CDATA as separate property
442
452
 
443
453
  3.0.1 / 2018-02-09
444
- * fix CRLF: replace it with single space in attributes value only.
454
+ - fix CRLF: replace it with single space in attributes value only.
445
455
 
446
456
  3.0.0 / 2018-02-08
447
- * change online tool with new changes
448
- * update info about new options
449
- * separate tag value processing to separate function
450
- * make HTML decoding optional
451
- * give an option to allow boolean attributes
452
- * change cli options as per v3
453
- * Correct comparison table format on README
454
- * update v3 information
455
- * some performance improvement changes
456
- * Make regex object local to the method and move some common methods to util
457
- * Change parser to
457
+ - change online tool with new changes
458
+ - update info about new options
459
+ - separate tag value processing to separate function
460
+ - make HTML decoding optional
461
+ - give an option to allow boolean attributes
462
+ - change cli options as per v3
463
+ - Correct comparison table format on README
464
+ - update v3 information
465
+ - some performance improvement changes
466
+ - Make regex object local to the method and move some common methods to util
467
+ - Change parser to
458
468
  - handle multiple instances of CDATA
459
469
  - make triming of value optionals
460
470
  - HTML decode attribute and text value
461
471
  - refactor code to separate files
462
- * Ignore newline chars without RE (in validator)
463
- * validate for XML prolog
464
- * Validate DOCTYPE without RE
465
- * Update validator to return error response
466
- * Update README to add detail about V3
467
- * Separate xmlNode model class
468
- * include vscode debug config
469
- * fix for repeated object
470
- * fix attribute regex for boolean attributes
471
- * Fix validator for invalid attributes
472
+ - Ignore newline chars without RE (in validator)
473
+ - validate for XML prolog
474
+ - Validate DOCTYPE without RE
475
+ - Update validator to return error response
476
+ - Update README to add detail about V3
477
+ - Separate xmlNode model class
478
+ - include vscode debug config
479
+ - fix for repeated object
480
+ - fix attribute regex for boolean attributes
481
+ - Fix validator for invalid attributes
472
482
  2.9.4 / 2018-02-02
473
- * Merge pull request: Decode HTML characters
474
- * refactor source folder name
475
- * ignore bundle / browser js to be published to npm
483
+ - Merge pull request: Decode HTML characters
484
+ - refactor source folder name
485
+ - ignore bundle / browser js to be published to npm
476
486
  2.9.3 / 2018-01-26
477
- * Merge pull request: Correctly remove CRLF line breaks
478
- * Enable to parse attribute in online editor
479
- * Fix testing demo app test
480
- * Describe parsing options
481
- * Add options for online demo
487
+ - Merge pull request: Correctly remove CRLF line breaks
488
+ - Enable to parse attribute in online editor
489
+ - Fix testing demo app test
490
+ - Describe parsing options
491
+ - Add options for online demo
482
492
  2.9.2 / 2018-01-18
483
- * Remove check if tag starting with "XML"
484
- * Fix: when there are spaces before / after CDATA
493
+ - Remove check if tag starting with "XML"
494
+ - Fix: when there are spaces before / after CDATA
485
495
 
486
496
  2.9.1 / 2018-01-16
487
- * Fix: newline should be replaced with single space
488
- * Fix: for single and multiline comments
489
- * validate xml with CDATA
490
- * Fix: the issue when there is no space between 2 attributes
491
- * Fix: https://github.com/NaturalIntelligence/fast-xml-parser/issues/33: when there is newline char in attr val, it doesn't parse
492
- * Merge pull request: fix ignoreNamespace
493
- * fix: don't wrap attributes if only namespace attrs
494
- * fix: use portfinder for run tests, update deps
495
- * fix: don't treat namespaces as attributes when ignoreNamespace enabled
497
+ - Fix: newline should be replaced with single space
498
+ - Fix: for single and multiline comments
499
+ - validate xml with CDATA
500
+ - Fix: the issue when there is no space between 2 attributes
501
+ - Fix: https://github.com/NaturalIntelligence/fast-xml-parser/issues/33: when there is newline char in attr val, it doesn't parse
502
+ - Merge pull request: fix ignoreNamespace
503
+ - fix: don't wrap attributes if only namespace attrs
504
+ - fix: use portfinder for run tests, update deps
505
+ - fix: don't treat namespaces as attributes when ignoreNamespace enabled
496
506
 
497
507
  2.9.0 / 2018-01-10
498
- * Rewrite the validator to handle large files.
508
+ - Rewrite the validator to handle large files.
499
509
  Ignore DOCTYPE validation.
500
- * Fix: When attribute value has equal sign
510
+ - Fix: When attribute value has equal sign
501
511
 
502
512
  2.8.3 / 2017-12-15
503
- * Fix: when a tag has value along with subtags
513
+ - Fix: when a tag has value along with subtags
504
514
 
505
515
  2.8.2 / 2017-12-04
506
- * Fix value parsing for IE
516
+ - Fix value parsing for IE
507
517
 
508
518
  2.8.1 / 2017-12-01
509
- * fix: validator should return false instead of err when invalid XML
519
+ - fix: validator should return false instead of err when invalid XML
510
520
 
511
521
  2.8.0 / 2017-11-29
512
- * Add CLI option to ignore value conversion
513
- * Fix variable name when filename is given on CLI
514
- * Update CLI help text
515
- * Merge pull request: xml2js: Accept standard input
516
- * Test Node 8
517
- * Update dependencies
518
- * Bundle readToEnd
519
- * Add ability to read from standard input
522
+ - Add CLI option to ignore value conversion
523
+ - Fix variable name when filename is given on CLI
524
+ - Update CLI help text
525
+ - Merge pull request: xml2js: Accept standard input
526
+ - Test Node 8
527
+ - Update dependencies
528
+ - Bundle readToEnd
529
+ - Add ability to read from standard input
520
530
 
521
531
  2.7.4 / 2017-09-22
522
- * Merge pull request: Allow wrap attributes with subobject to compatible with other parsers output
532
+ - Merge pull request: Allow wrap attributes with subobject to compatible with other parsers output
523
533
 
524
534
  2.7.3 / 2017-08-02
525
- * fix: handle CDATA with regx
535
+ - fix: handle CDATA with regx
526
536
 
527
537
  2.7.2 / 2017-07-30
528
- * Change travis config for yarn caching
529
- * fix validator: when tag property is same as array property
530
- * Merge pull request: Failing test case in validator for valid SVG
538
+ - Change travis config for yarn caching
539
+ - fix validator: when tag property is same as array property
540
+ - Merge pull request: Failing test case in validator for valid SVG
531
541
 
532
542
  2.7.1 / 2017-07-26
533
- * Fix: Handle val 0
543
+ - Fix: Handle val 0
534
544
 
535
545
  2.7.0 / 2017-07-25
536
- * Fix test for arrayMode
537
- * Merge pull request: Add arrayMode option to parse any nodes as arrays
546
+ - Fix test for arrayMode
547
+ - Merge pull request: Add arrayMode option to parse any nodes as arrays
538
548
 
539
549
  2.6.0 / 2017-07-14
540
- * code improvement
541
- * Add unit tests for value conversion for attr
542
- * Merge pull request: option of an attribute value conversion to a number (textAttrConversion) the same way as the textNodeConversion option does. Default value is false.
550
+ - code improvement
551
+ - Add unit tests for value conversion for attr
552
+ - Merge pull request: option of an attribute value conversion to a number (textAttrConversion) the same way as the textNodeConversion option does. Default value is false.
543
553
 
544
554
  2.5.1 / 2017-07-01
545
- * Fix XML element name pattern
546
- * Fix XML element name pattern while parsing
547
- * Fix validation for xml tag element
555
+ - Fix XML element name pattern
556
+ - Fix XML element name pattern while parsing
557
+ - Fix validation for xml tag element
548
558
 
549
559
  2.5.0 / 2017-06-25
550
- * Improve Validator performance
551
- * update attr matching regex
552
- * Add perf tests
553
- * Improve atrr regex to handle all cases
560
+ - Improve Validator performance
561
+ - update attr matching regex
562
+ - Add perf tests
563
+ - Improve atrr regex to handle all cases
554
564
 
555
565
  2.4.4 / 2017-06-08
556
- * Bug fix: when an attribute has single or double quote in value
566
+ - Bug fix: when an attribute has single or double quote in value
557
567
 
558
568
  2.4.3 / 2017-06-05
559
- * Bug fix: when multiple CDATA tags are given
560
- * Merge pull request: add option "textNodeConversion"
561
- * add option "textNodeConversion"
569
+ - Bug fix: when multiple CDATA tags are given
570
+ - Merge pull request: add option "textNodeConversion"
571
+ - add option "textNodeConversion"
562
572
 
563
573
  2.4.1 / 2017-04-14
564
- * fix tests
565
- * Bug fix: preserve initial space of node value
566
- * Handle CDATA
574
+ - fix tests
575
+ - Bug fix: preserve initial space of node value
576
+ - Handle CDATA
567
577
 
568
578
  2.3.1 / 2017-03-15
569
- * Bug fix: when single self closing tag
570
- * Merge pull request: fix .codeclimate.yml
571
- * Update .codeclimate.yml - Fixed config so it does not error anymore.
572
- * Update .codeclimate.yml
579
+ - Bug fix: when single self closing tag
580
+ - Merge pull request: fix .codeclimate.yml
581
+ - Update .codeclimate.yml - Fixed config so it does not error anymore.
582
+ - Update .codeclimate.yml
573
583
 
574
584
  2.3.0 / 2017-02-26
575
- * Code improvement
576
- * add bithound config
577
- * Update usage
578
- * Update travis to generate bundle js before running tests
579
- * 1.Browserify, 2. add more tests for validator
580
- * Add validator
581
- * Fix CLI default parameter bug
585
+ - Code improvement
586
+ - add bithound config
587
+ - Update usage
588
+ - Update travis to generate bundle js before running tests
589
+ - 1.Browserify, 2. add more tests for validator
590
+ - Add validator
591
+ - Fix CLI default parameter bug
582
592
 
583
593
  2.2.1 / 2017-02-05
584
- * Bug fix: CLI default option
594
+ - Bug fix: CLI default option
package/README.md CHANGED
@@ -1,29 +1,32 @@
1
1
  # [fast-xml-parser](https://www.npmjs.com/package/fast-xml-parser)
2
- [![Known Vulnerabilities](https://snyk.io/test/github/naturalintelligence/fast-xml-parser/badge.svg)](https://snyk.io/test/github/naturalintelligence/fast-xml-parser)
3
2
  [![NPM quality][quality-image]][quality-url]
4
3
  [![Coverage Status](https://coveralls.io/repos/github/NaturalIntelligence/fast-xml-parser/badge.svg?branch=master)](https://coveralls.io/github/NaturalIntelligence/fast-xml-parser?branch=master)
5
4
  [<img src="https://img.shields.io/badge/Try-me-blue.svg?colorA=FFA500&colorB=0000FF" alt="Try me"/>](https://naturalintelligence.github.io/fast-xml-parser/)
6
5
  [![NPM total downloads](https://img.shields.io/npm/dt/fast-xml-parser.svg)](https://npm.im/fast-xml-parser)
7
6
 
8
- [quality-image]: http://npm.packagequality.com/shield/fast-xml-parser.svg?style=flat-square
9
- [quality-url]: http://packagequality.com/#?package=fast-xml-parser
10
-
11
7
 
12
8
  Validate XML, Parse XML to JS Object, or Build XML from JS Object without C/C++ based libraries and no callback.
13
9
 
14
- > XML Parser v5 is added for experimental use
15
- > https://solothought.com
10
+ ---
11
+
12
+ <a href="https://www.amazon.in/Power-Glasses-world-imagination-Perspective-ebook/dp/B0CW1CJGNK/"><img align="left" src="https://github.com/NaturalIntelligence/fast-xml-parser/assets/7692328/e7a42bcc-5186-45e3-bfee-de8d8b9a69d4" alt="ads-thePowerGlassesBook"/></a>
13
+ I had recently published a book, The Power Glasses. Please have a look. Your feedback would be helpful. You can [mail](githubissues@proton.me) me for a free copy.
14
+ <br>
15
+
16
+ Sponsor this project
16
17
 
17
- Sponsor this project 👉
18
18
  <a href="https://github.com/sponsors/NaturalIntelligence">
19
- <img src="https://raw.githubusercontent.com/NaturalIntelligence/ThankYouBackers/main/github_sponsor.png" width="200" />
19
+ <img src="https://raw.githubusercontent.com/NaturalIntelligence/ThankYouBackers/main/github_sponsor.png" width="180" />
20
20
  </a>
21
21
  <a href="https://opencollective.com/fast-xml-parser/donate" target="_blank">
22
- <img src="https://opencollective.com/fast-xml-parser/donate/button@2x.png?color=blue" width=200 />
22
+ <img src="https://opencollective.com/fast-xml-parser/donate/button@2x.png?color=blue" width=180 />
23
23
  </a>
24
- <a href="https://paypal.me/naturalintelligence"> <img src="static/img/support_paypal.svg" alt="Stubmatic donate button" width="200"/></a>
25
-
24
+ <a href="https://paypal.me/naturalintelligence"> <img src="static/img/support_paypal.svg" alt="Stubmatic donate button" width="180"/></a>
25
+ <br>
26
+ <br>
27
+ <br>
26
28
 
29
+ <!--
27
30
  ### Current Sponsors
28
31
 
29
32
  Check the complete list at [ThankYouBackers](https://github.com/NaturalIntelligence/ThankYouBackers) for our sponsors and supporters.
@@ -45,7 +48,9 @@ Through OpenCollective
45
48
  <a href="https://opencollective.com/fast-xml-parser/sponsor/7/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/7/avatar.svg"></a>
46
49
  <a href="https://opencollective.com/fast-xml-parser/sponsor/8/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/8/avatar.svg"></a>
47
50
  <a href="https://opencollective.com/fast-xml-parser/sponsor/9/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/9/avatar.svg"></a>
51
+ -->
48
52
 
53
+ ![fxp_sponsors](https://github.com/NaturalIntelligence/fast-xml-parser/assets/7692328/c9367497-d67e-410a-90a6-66e3808be929)
49
54
 
50
55
  ## Users
51
56
 
@@ -63,14 +68,15 @@ Through OpenCollective
63
68
  <a href="https://github.com/SAP" title="SAP" > <img src="https://user-images.githubusercontent.com/7692328/204835214-d9d25b58-e3df-408d-87a3-c7d36b578ee4.png" width="60px" ></a>
64
69
  <a href="https://github.com/postmanlabs" title="postman" > <img src="https://user-images.githubusercontent.com/7692328/204835529-e9e290ad-696a-49ad-9d34-08e955704715.png" width="60px" ></a>
65
70
  <a href="https://github.com/react-native-community" title="React Native Community" > <img src="https://avatars.githubusercontent.com/u/20269980?v=4" width="60px" ></a>
71
+ <a href="https://github.com/googleapis" title="Google APIs" > <img src="https://avatars.githubusercontent.com/u/16785467?v=4" width="60px" ></a>
72
+ <a href="https://github.com/langchain-ai" title="Langchain AI" > <img src="https://avatars.githubusercontent.com/u/126733545?v=4" width="60px" ></a>
73
+ <a href="https://github.com/withastro" title="Astro websie builder" > <img src="https://avatars.githubusercontent.com/u/44914786?v=4" width="60px" ></a>
74
+ <a href="https://github.com/baidu" title="Baidu" > <img src="https://avatars.githubusercontent.com/u/13245940?v=4" width="60px" ></a>
75
+ [more](./USERs.md)
66
76
 
67
- Check the bigger [list](./USERs.md)
68
-
69
- <small>The list of users is collected either from the list published by Github, communicated directly through mails/chat , or from other resources. If you feel that your name in the above list is incorrectly published or you're not the user of this library anymore then you can inform us to remove it. We'll do the necessary changes ASAP.</small>
77
+ <small>The list of users are mostly published by Github or communicated directly. Feel free to contact if you find any information wrong.</small>
70
78
 
71
- If you want to be an anonymous user of this application and don't want to be highlighted anywhere then you can contact me at
72
- - githubissues@proton.me
73
- - https://linkedin.com/in/amitguptagwl/
79
+ ---
74
80
 
75
81
  ## Main Features
76
82
 
@@ -79,7 +85,7 @@ If you want to be an anonymous user of this application and don't want to be hig
79
85
  * Validate XML data syntactically
80
86
  * Parse XML to JS Object
81
87
  * Build XML from JS Object
82
- * Works with node packages, in browser, and in CLI (press try me button above for demo)
88
+ * Compatible to node js packages, in browser, and in CLI (click try me button above for demo)
83
89
  * Faster than any other pure JS implementation.
84
90
  * It can handle big files (tested up to 100mb).
85
91
  * Controlled parsing using various options
@@ -137,49 +143,71 @@ In a HTML page
137
143
  </script>
138
144
  ```
139
145
 
140
- Check lib folder for different browser bundles
146
+ Bundle size
141
147
 
142
148
  | Bundle Name | Size |
143
149
  | ------------------ | ---- |
144
- | fxbuilder.min.js | 5.2K |
145
- | fxparser.js | 50K |
146
- | fxparser.min.js | 17K |
147
- | fxp.min.js | 22K |
150
+ | fxbuilder.min.js | 6.5K |
151
+ | fxparser.min.js | 20K |
152
+ | fxp.min.js | 26K |
148
153
  | fxvalidator.min.js | 5.7K |
149
154
 
150
155
  ### Documents
151
- **v3**
152
- * [documents](./docs/v3/docs.md)
153
-
154
- **v4**
155
- 1. [GettingStarted.md](./docs/v4/1.GettingStarted.md)
156
- 2. [XML Parser](./docs/v4/2.XMLparseOptions.md)
157
- 3. [XML Builder](./docs/v4/3.XMLBuilder.md)
158
- 4. [XML Validator](./docs/v4/4.XMLValidator.md)
159
- 5. [Entities](./docs/v4/5.Entities.md)
160
- 6. [HTML Document Parsing](./docs/v4/6.HTMLParsing.md)
161
- 7. [PI Tag processing](./docs/v4/7.PITags.md)
156
+ <table>
157
+ <tr><td>v3</td><td>v4</td><td>v5</td></tr>
158
+ <tr>
159
+ <td>
160
+ <a href="./docs/v3/docs.md">documents</a>
161
+ </td>
162
+ <td><ol>
163
+ <li><a href="./docs/v4/1.GettingStarted.md">Getting Started</a></li>
164
+ <li><a href="./docs/v4/2.XMLparseOptions.md">XML Parser</a></li>
165
+ <li><a href="./docs/v4/3.XMLBuilder.md">XML Builder</a></li>
166
+ <li><a href="./docs/v4/4.XMLValidator.md">XML Validator</a></li>
167
+ <li><a href="./docs/v4/5.Entities.md">Entities</a></li>
168
+ <li><a href="./docs/v4/6.HTMLParsing.md">HTML Document Parsing</a></li>
169
+ <li><a href="./docs/v4/7.PITags.md">PI Tag processing</a></li>
170
+ </ol></td>
171
+ <td><ol>
172
+ <li></li><a href="./docs/v5/1.GettingStarted.md">Getting Started</a></li>
173
+ <li><a href="./docs/v5/2.Features.md">Features</a></li>
174
+ <li><a href="./docs/v5/3.Options.md">Options</a></li>
175
+ <li><a href="./docs/v5/4.OutputBuilders.md">Output Builders</a></li>
176
+ <li><a href="./docs/v5/5.ValueParsers.md">Value Parsers</a></li>
177
+ </ol></td>
178
+ </tr>
179
+ </table>
180
+
181
+ **note**: version 5 is released with version 4 tfor experimental use. Based on it's demand, it'll be developed and the features can be different in final release.
182
+
162
183
  ## Performance
184
+ <small>negative means error</small>
163
185
 
164
186
  ### XML Parser
165
187
 
166
- ![](./docs/imgs/XMLParser_v4.png)
188
+ <img align="left" src="./docs/imgs/XMLParser_v4.png" width="45%" />
189
+ <img src="./docs/imgs/XMLParser_large_v4.png" width="47%" />
190
+
167
191
  * Y-axis: requests per second
168
192
  * X-axis: File size
169
193
 
170
- **Large files**
171
- ![](./docs/imgs/XMLParser_large_v4.png)
172
- * Y-axis: requests per second
173
- * X-axis: File size
174
194
  ### XML Builder
175
195
 
176
- ![](./docs/imgs/XMLBuilder_v4.png)
196
+ <img src="./docs/imgs/XMLBuilder_v4.png" width="50%" />
177
197
  * Y-axis: requests per second
178
198
 
179
- <small>negative means error</small>
180
199
 
181
- [![](static/img/ni_ads_ads.gif)](https://github.com/NaturalIntelligence/ads/)
182
200
 
201
+ <!-- [![](static/img/ni_ads_ads.gif)](https://github.com/NaturalIntelligence/ads/) -->
202
+
203
+
204
+ ## Usage Trend
205
+
206
+ [Usage Trend of fast-xml-parser](https://npm-compare.com/fast-xml-parser#timeRange=THREE_YEARS)
207
+
208
+ <a href="https://npm-compare.com/fast-xml-parser#timeRange=THREE_YEARS" target="_blank">
209
+ <img src="https://npm-compare.com/img/npm-trend/THREE_YEARS/fast-xml-parser.png" width="50%" alt="NPM Usage Trend of fast-xml-parser" />
210
+ </a>
183
211
 
184
212
  ## Supporters
185
213
  ### Contributors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-xml-parser",
3
- "version": "4.3.6",
3
+ "version": "4.4.1",
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
@@ -345,7 +345,7 @@ type XmlBuilderOptions = {
345
345
  *
346
346
  * Defaults to `(tagName, val, jPath, hasAttributes, isLeafNode) => val`
347
347
  */
348
- tagValueProcessor?: (name: string, value: unknown) => string;
348
+ tagValueProcessor?: (name: string, value: unknown) => unknown;
349
349
 
350
350
  /**
351
351
  * Control how attribute value should be parsed
@@ -358,7 +358,7 @@ type XmlBuilderOptions = {
358
358
  *
359
359
  * Defaults to `(attrName, val, jPath) => val`
360
360
  */
361
- attributeValueProcessor?: (name: string, value: unknown) => string;
361
+ attributeValueProcessor?: (name: string, value: unknown) => unknown;
362
362
 
363
363
  /**
364
364
  * Whether to process default and DOCTYPE entities
@@ -3,7 +3,7 @@ const {buildOptions,registerCommonValueParsers} = require("./ParserOptionsBuilde
3
3
  class OutputBuilder{
4
4
  constructor(options){
5
5
  this.options = buildOptions(options);
6
- this.registeredParsers = registerCommonValueParsers();
6
+ this.registeredParsers = registerCommonValueParsers(this.options);
7
7
  }
8
8
 
9
9
  registerValueParser(name,parserInstance){//existing name will override the parser without warning
@@ -3,7 +3,7 @@ const {buildOptions,registerCommonValueParsers} = require("./ParserOptionsBuilde
3
3
  class OutputBuilder{
4
4
  constructor(options){
5
5
  this.options = buildOptions(options);
6
- this.registeredParsers = registerCommonValueParsers();
6
+ this.registeredParsers = registerCommonValueParsers(this.options);
7
7
  }
8
8
 
9
9
  registerValueParser(name,parserInstance){//existing name will override the parser without warning
@@ -5,7 +5,7 @@ const {buildOptions,registerCommonValueParsers} = require("./ParserOptionsBuilde
5
5
  class OutputBuilder{
6
6
  constructor(builderOptions){
7
7
  this.options = buildOptions(builderOptions);
8
- this.registeredParsers = registerCommonValueParsers();
8
+ this.registeredParsers = registerCommonValueParsers(this.options);
9
9
  }
10
10
 
11
11
  registerValueParser(name,parserInstance){//existing name will override the parser without warning
@@ -34,6 +34,9 @@ const defaultOptions={
34
34
  // "currency",
35
35
  // "date",
36
36
  ]
37
+ },
38
+ dataType:{
39
+
37
40
  }
38
41
  }
39
42
 
@@ -75,7 +78,7 @@ function copyProperties(target, source) {
75
78
  }
76
79
  }
77
80
 
78
- function registerCommonValueParsers(){
81
+ function registerCommonValueParsers(options){
79
82
  return {
80
83
  "trim": new trimParser(),
81
84
  // "join": this.entityParser.parse,
@@ -1,4 +1,7 @@
1
-
1
+ const defaultOptions = {
2
+ maxLength: 200,
3
+ // locale: "en-IN"
4
+ }
2
5
  const localeMap = {
3
6
  "$":"en-US",
4
7
  "€":"de-DE",
@@ -6,15 +9,19 @@ const localeMap = {
6
9
  "¥":"ja-JP",
7
10
  "₹":"en-IN",
8
11
  }
12
+ const sign = "(?:-|\+)?";
13
+ const digitsAndSeparator = "(?:\d+|\d{1,3}(?:,\d{3})+)";
14
+ const decimalPart = "(?:\.\d{1,2})?";
15
+ const symbol = "(?:\$|€|¥|₹)?";
9
16
 
10
17
  const currencyCheckRegex = /^\s*(?:-|\+)?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d{1,2})?\s*(?:\$|€|¥|₹)?\s*$/u;
11
18
 
12
19
  class CurrencyParser{
13
20
  constructor(options){
14
- this.options = options;
21
+ this.options = options || defaultOptions;
15
22
  }
16
23
  parse(val){
17
- if (typeof val === 'string') {
24
+ if (typeof val === 'string' && val.length <= this.options.maxLength) {
18
25
  if(val.indexOf(",,") !== -1 && val.indexOf(".." !== -1)){
19
26
  const match = val.match(currencyCheckRegex);
20
27
  if(match){
@@ -28,4 +35,6 @@ class CurrencyParser{
28
35
  return val;
29
36
  }
30
37
  }
38
+ CurrencyParser.defaultOptions = defaultOptions;
39
+
31
40
  module.exports = CurrencyParser;
package/src/validator.js CHANGED
@@ -103,6 +103,8 @@ exports.validate = function (xmlData, options) {
103
103
  return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
104
104
  } else if (attrStr.trim().length > 0) {
105
105
  return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
106
+ } else if (tags.length === 0) {
107
+ return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
106
108
  } else {
107
109
  const otg = tags.pop();
108
110
  if (tagName !== otg.tagName) {
@@ -115,6 +115,7 @@ Builder.prototype.j2x = function(jObj, level) {
115
115
  //repeated nodes
116
116
  const arrLen = jObj[key].length;
117
117
  let listTagVal = "";
118
+ let listTagAttr = "";
118
119
  for (let j = 0; j < arrLen; j++) {
119
120
  const item = jObj[key][j];
120
121
  if (typeof item === 'undefined') {
@@ -124,17 +125,27 @@ Builder.prototype.j2x = function(jObj, level) {
124
125
  else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
125
126
  // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
126
127
  } else if (typeof item === 'object') {
127
- if(this.options.oneListGroup ){
128
- listTagVal += this.j2x(item, level + 1).val;
128
+ if(this.options.oneListGroup){
129
+ const result = this.j2x(item, level + 1);
130
+ listTagVal += result.val;
131
+ if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
132
+ listTagAttr += result.attrStr
133
+ }
129
134
  }else{
130
135
  listTagVal += this.processTextOrObjNode(item, key, level)
131
136
  }
132
137
  } else {
133
- listTagVal += this.buildTextValNode(item, key, '', level);
138
+ if (this.options.oneListGroup) {
139
+ let textValue = this.options.tagValueProcessor(key, item);
140
+ textValue = this.replaceEntitiesValue(textValue);
141
+ listTagVal += textValue;
142
+ } else {
143
+ listTagVal += this.buildTextValNode(item, key, '', level);
144
+ }
134
145
  }
135
146
  }
136
147
  if(this.options.oneListGroup){
137
- listTagVal = this.buildObjectNode(listTagVal, key, '', level);
148
+ listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);
138
149
  }
139
150
  val += listTagVal;
140
151
  } else {
@@ -311,10 +311,18 @@ const parseXml = function(xmlData) {
311
311
  let tagContent = "";
312
312
  //self-closing tag
313
313
  if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
314
+ if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
315
+ tagName = tagName.substr(0, tagName.length - 1);
316
+ jPath = jPath.substr(0, jPath.length - 1);
317
+ tagExp = tagName;
318
+ }else{
319
+ tagExp = tagExp.substr(0, tagExp.length - 1);
320
+ }
314
321
  i = result.closeIndex;
315
322
  }
316
323
  //unpaired tag
317
324
  else if(this.options.unpairedTags.indexOf(tagName) !== -1){
325
+
318
326
  i = result.closeIndex;
319
327
  }
320
328
  //normal tag