fast-xml-parser 4.4.0 → 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 +329 -324
- package/README.md +70 -42
- package/package.json +1 -1
- package/src/v5/OutputBuilders/JsArrBuilder.js +1 -1
- package/src/v5/OutputBuilders/JsMinArrBuilder.js +1 -1
- package/src/v5/OutputBuilders/JsObjBuilder.js +1 -1
- package/src/v5/OutputBuilders/ParserOptionsBuilder.js +4 -1
- package/src/v5/valueParsers/currency.js +12 -3
- package/src/xmlbuilder/json2xml.js +15 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,214 +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))
|
|
2
7
|
|
|
3
8
|
**4.4.0 / 2024-05-18**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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]())
|
|
7
12
|
|
|
8
13
|
**4.3.6 / 2024-03-16**
|
|
9
|
-
|
|
14
|
+
- Add support for parsing HTML numeric entities (#645) (By [Jonas Schade ](https://github.com/DerZade))
|
|
10
15
|
|
|
11
16
|
**4.3.5 / 2024-02-24**
|
|
12
|
-
|
|
17
|
+
- code for v5 is added for experimental use
|
|
13
18
|
|
|
14
19
|
**4.3.4 / 2024-01-10**
|
|
15
|
-
|
|
20
|
+
- fix: Don't escape entities in CDATA sections (#633) (By [wackbyte](https://github.com/wackbyte))
|
|
16
21
|
|
|
17
22
|
**4.3.3 / 2024-01-10**
|
|
18
|
-
|
|
23
|
+
- Remove unnecessary regex
|
|
19
24
|
|
|
20
25
|
**4.3.2 / 2023-10-02**
|
|
21
|
-
|
|
26
|
+
- fix `jObj.hasOwnProperty` when give input is null (By [Arda TANRIKULU](https://github.com/ardatan))
|
|
22
27
|
|
|
23
28
|
**4.3.1 / 2023-09-24**
|
|
24
|
-
|
|
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.
|
|
25
30
|
|
|
26
31
|
**4.3.0 / 2023-09-20**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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))
|
|
30
35
|
|
|
31
36
|
**4.2.7 / 2023-07-30**
|
|
32
|
-
|
|
33
|
-
|
|
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))
|
|
34
39
|
|
|
35
40
|
**4.2.6 / 2023-07-17**
|
|
36
|
-
|
|
41
|
+
- Fix: Remove trailing slash from jPath for self-closing tags (#595) (By [Maciej Radzikowski](https://github.com/m-radzikowski))
|
|
37
42
|
|
|
38
43
|
**4.2.5 / 2023-06-22**
|
|
39
|
-
|
|
44
|
+
- change code implementation
|
|
40
45
|
|
|
41
46
|
**4.2.4 / 2023-06-06**
|
|
42
|
-
|
|
47
|
+
- fix security bug
|
|
43
48
|
|
|
44
49
|
**4.2.3 / 2023-06-05**
|
|
45
|
-
|
|
50
|
+
- fix security bug
|
|
46
51
|
|
|
47
52
|
**4.2.2 / 2023-04-18**
|
|
48
|
-
|
|
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
|
|
49
54
|
|
|
50
55
|
**4.2.1 / 2023-04-18**
|
|
51
|
-
|
|
56
|
+
- fix: jpath after unpaired tags
|
|
52
57
|
|
|
53
58
|
**4.2.0 / 2023-04-09**
|
|
54
|
-
|
|
59
|
+
- support `updateTag` parser property
|
|
55
60
|
|
|
56
61
|
**4.1.4 / 2023-04-08**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
|
60
65
|
|
|
61
66
|
**4.1.3 / 2023-02-26**
|
|
62
|
-
|
|
67
|
+
- fix #546: Support complex entity value
|
|
63
68
|
|
|
64
69
|
**4.1.2 / 2023-02-12**
|
|
65
|
-
|
|
70
|
+
- Security Fix
|
|
66
71
|
|
|
67
72
|
**4.1.1 / 2023-02-03**
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
- Fix #540: ignoreAttributes breaks unpairedTags
|
|
74
|
+
- Refactor XML builder code
|
|
70
75
|
|
|
71
76
|
**4.1.0 / 2023-02-02**
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
- Fix '<' or '>' in DTD comment throwing an error. (#533) (By [Adam Baker](https://github.com/Cwazywierdo))
|
|
78
|
+
- Set "eNotation" to 'true' as default
|
|
74
79
|
|
|
75
80
|
**4.0.15 / 2023-01-25**
|
|
76
|
-
|
|
81
|
+
- make "eNotation" optional
|
|
77
82
|
|
|
78
83
|
**4.0.14 / 2023-01-22**
|
|
79
|
-
|
|
84
|
+
- fixed: add missed typing "eNotation" to parse values
|
|
80
85
|
|
|
81
86
|
**4.0.13 / 2023-01-07**
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
- preserveorder formatting (By [mdeknowis](https://github.com/mdeknowis))
|
|
88
|
+
- support `transformAttributeName` (By [Erik Rothoff Andersson](https://github.com/erkie))
|
|
84
89
|
|
|
85
90
|
**4.0.12 / 2022-11-19**
|
|
86
|
-
|
|
91
|
+
- fix typescript
|
|
87
92
|
|
|
88
93
|
**4.0.11 / 2022-10-05**
|
|
89
|
-
|
|
94
|
+
- fix #501: parse for entities only once
|
|
90
95
|
|
|
91
96
|
**4.0.10 / 2022-09-14**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
|
95
100
|
|
|
96
101
|
|
|
97
102
|
**4.0.9 / 2022-07-10**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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))
|
|
102
107
|
|
|
103
108
|
**4.0.8 / 2022-05-28**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
|
107
112
|
|
|
108
113
|
**4.0.7 / 2022-03-18**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
|
112
117
|
|
|
113
118
|
**4.0.6 / 2022-03-08**
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
- fix: call tagValueProcessor only once for array items
|
|
120
|
+
- fix: missing changed for #437
|
|
116
121
|
|
|
117
122
|
**4.0.5 / 2022-03-06**
|
|
118
|
-
|
|
123
|
+
- fix #437: call tagValueProcessor from XML builder
|
|
119
124
|
|
|
120
125
|
**4.0.4 / 2022-03-03**
|
|
121
|
-
|
|
126
|
+
- fix #435: should skip unpaired and self-closing nodes when set as stopnodes
|
|
122
127
|
|
|
123
128
|
**4.0.3 / 2022-02-15**
|
|
124
|
-
|
|
129
|
+
- fix: ReferenceError when Bundled with Strict (#431) (By [Andreas Heissenberger](https://github.com/aheissenberger))
|
|
125
130
|
|
|
126
131
|
|
|
127
132
|
**4.0.2 / 2022-02-04**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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 `&`
|
|
132
137
|
|
|
133
138
|
**4.0.1 / 2022-01-08**
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
- fix builder for pi tag
|
|
140
|
+
- fix: support suppressBooleanAttrs by builder
|
|
136
141
|
|
|
137
142
|
**4.0.0 / 2022-01-06**
|
|
138
|
-
|
|
139
|
-
|
|
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.
|
|
140
145
|
|
|
141
146
|
**4.0.0-beta.8 / 2021-12-13**
|
|
142
|
-
|
|
147
|
+
- call tagValueProcessor for stop nodes
|
|
143
148
|
|
|
144
149
|
**4.0.0-beta.7 / 2021-12-09**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
|
150
155
|
|
|
151
156
|
**4.0.0-beta.6 / 2021-12-05**
|
|
152
|
-
|
|
153
|
-
|
|
157
|
+
- Support PI Tags processing
|
|
158
|
+
- Support `suppressBooleanAttributes` by XML Builder for attributes with value `true`.
|
|
154
159
|
|
|
155
160
|
**4.0.0-beta.5 / 2021-12-04**
|
|
156
|
-
|
|
161
|
+
- fix: when a tag with name "attributes"
|
|
157
162
|
|
|
158
163
|
**4.0.0-beta.4 / 2021-12-02**
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
|
163
168
|
|
|
164
169
|
**4.0.0-beta.3 / 2021-11-30**
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
|
170
175
|
|
|
171
176
|
**⚠️ 4.0.0-beta.2 / 2021-11-19**
|
|
172
|
-
|
|
173
|
-
|
|
177
|
+
- rename `attrMap` to `attibutes` in parser output when `preserveOrder:true`
|
|
178
|
+
- supports unpairedTags
|
|
174
179
|
|
|
175
180
|
**⚠️ 4.0.0-beta.1 / 2021-11-18**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
|
182
187
|
|
|
183
188
|
**⚠️ 4.0.0-beta.0 / 2021-11-16**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
|
200
205
|
|
|
201
206
|
3.21.1 / 2021-10-31
|
|
202
|
-
|
|
207
|
+
- Correctly format JSON elements with a text prop but no attribute props ( By [haddadnj](https://github.com/haddadnj) )
|
|
203
208
|
|
|
204
209
|
3.21.0 / 2021-10-25
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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
|
|
212
217
|
```js
|
|
213
218
|
{
|
|
214
219
|
"code": "InvalidAttr",
|
|
@@ -219,371 +224,371 @@ Note: If you find missing information about particular minor version, that versi
|
|
|
219
224
|
```
|
|
220
225
|
|
|
221
226
|
3.20.1 / 2021-09-25
|
|
222
|
-
|
|
227
|
+
- update strnum package
|
|
223
228
|
|
|
224
229
|
3.20.0 / 2021-09-10
|
|
225
|
-
|
|
226
|
-
|
|
230
|
+
- Use strnum npm package to parse string to number
|
|
231
|
+
- breaking change: long number will be parsed to scientific notation.
|
|
227
232
|
|
|
228
233
|
3.19.0 / 2021-03-14
|
|
229
|
-
|
|
230
|
-
|
|
234
|
+
- License changed to MIT original
|
|
235
|
+
- Fix #321 : namespace tag parsing
|
|
231
236
|
|
|
232
237
|
3.18.0 / 2021-02-05
|
|
233
|
-
|
|
234
|
-
|
|
238
|
+
- Support RegEx and function in arrayMode option
|
|
239
|
+
- Fix #317 : validate nested PI tags
|
|
235
240
|
|
|
236
241
|
3.17.4 / 2020-06-07
|
|
237
|
-
|
|
238
|
-
|
|
242
|
+
- Refactor some code to support IE11
|
|
243
|
+
- Fix: `<tag >` space as attribute string
|
|
239
244
|
|
|
240
245
|
3.17.3 / 2020-05-23
|
|
241
|
-
|
|
242
|
-
|
|
246
|
+
- Fix: tag name separated by \n \t
|
|
247
|
+
- Fix: throw error for unclosed tags
|
|
243
248
|
|
|
244
249
|
3.17.2 / 2020-05-23
|
|
245
|
-
|
|
246
|
-
|
|
250
|
+
- Fixed an issue in processing doctype tag
|
|
251
|
+
- Fixed tagName where it should not have whitespace chars
|
|
247
252
|
|
|
248
253
|
3.17.1 / 2020-05-19
|
|
249
|
-
|
|
254
|
+
- Fixed an issue in checking opening tag
|
|
250
255
|
|
|
251
256
|
3.17.0 / 2020-05-18
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
|
258
263
|
|
|
259
264
|
3.16.0 / 2020-01-12
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
265
|
+
- validaor: fix for ampersand characters (#215)
|
|
266
|
+
- refactoring to support unicode chars in tag name
|
|
267
|
+
- update typing for validator error
|
|
263
268
|
|
|
264
269
|
3.15.1 / 2019-12-09
|
|
265
|
-
|
|
270
|
+
- validaor: fix multiple roots are not allowed
|
|
266
271
|
|
|
267
272
|
3.15.0 / 2019-11-23
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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
|
|
271
276
|
|
|
272
277
|
3.14.0 / 2019-10-25
|
|
273
|
-
|
|
278
|
+
- arrayMode for XML to JS obj parsing
|
|
274
279
|
|
|
275
280
|
3.13.0 / 2019-10-02
|
|
276
|
-
|
|
277
|
-
|
|
281
|
+
- pass tag/attr name to tag/attr value processor
|
|
282
|
+
- inbuilt optional validation with XML parser
|
|
278
283
|
|
|
279
284
|
3.12.21 / 2019-10-02
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
285
|
+
- Fix validator for unclosed XMLs
|
|
286
|
+
- move nimnjs dependency to dev dependency
|
|
287
|
+
- update dependencies
|
|
283
288
|
|
|
284
289
|
3.12.20 / 2019-08-16
|
|
285
|
-
|
|
290
|
+
- Revert: Fix #167: '>' in attribute value as it is causing high performance degrade.
|
|
286
291
|
|
|
287
292
|
3.12.19 / 2019-07-28
|
|
288
|
-
|
|
293
|
+
- Fix js to xml parser should work for date values. (broken: `tagValueProcessor` will receive the original value instead of string always) (breaking change)
|
|
289
294
|
|
|
290
295
|
3.12.18 / 2019-07-27
|
|
291
|
-
|
|
296
|
+
- remove configstore dependency
|
|
292
297
|
|
|
293
298
|
3.12.17 / 2019-07-14
|
|
294
|
-
|
|
299
|
+
- Fix #167: '>' in attribute value
|
|
295
300
|
|
|
296
301
|
3.12.16 / 2019-03-23
|
|
297
|
-
|
|
302
|
+
- Support a new option "stopNodes". (#150)
|
|
298
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.
|
|
299
|
-
|
|
304
|
+
- Don't show post-install message
|
|
300
305
|
|
|
301
306
|
3.12.12 / 2019-01-11
|
|
302
|
-
|
|
307
|
+
- fix : IE parseInt, parseFloat error
|
|
303
308
|
|
|
304
309
|
3.12.11 / 2018-12-24
|
|
305
|
-
|
|
310
|
+
- fix #132: "/" should not be parsed as boolean attr in case of self closing tags
|
|
306
311
|
|
|
307
312
|
3.12.9 / 2018-11-23
|
|
308
|
-
|
|
313
|
+
- fix #129 : validator should not fail when an atrribute name is 'length'
|
|
309
314
|
|
|
310
315
|
3.12.8 / 2018-11-22
|
|
311
|
-
|
|
316
|
+
- fix #128 : use 'attrValueProcessor' to process attribute value in json2xml parser
|
|
312
317
|
|
|
313
318
|
3.12.6 / 2018-11-10
|
|
314
|
-
|
|
319
|
+
- Fix #126: check for type
|
|
315
320
|
|
|
316
321
|
3.12.4 / 2018-09-12
|
|
317
|
-
|
|
322
|
+
- Fix: include tasks in npm package
|
|
318
323
|
|
|
319
324
|
3.12.3 / 2018-09-12
|
|
320
|
-
|
|
325
|
+
- Fix CLI issue raised in last PR
|
|
321
326
|
|
|
322
327
|
3.12.2 / 2018-09-11
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
328
|
+
- Fix formatting for JSON to XML output
|
|
329
|
+
- Migrate to webpack (PR merged)
|
|
330
|
+
- fix cli (PR merged)
|
|
326
331
|
|
|
327
332
|
3.12.0 / 2018-08-06
|
|
328
|
-
|
|
329
|
-
|
|
333
|
+
- Support hexadecimal values
|
|
334
|
+
- Support true number parsing
|
|
330
335
|
|
|
331
336
|
3.11.2 / 2018-07-23
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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
|
|
337
342
|
|
|
338
343
|
3.11.1 / 2018-06-05
|
|
339
|
-
|
|
344
|
+
- fix #93: read the text after self closing tag
|
|
340
345
|
|
|
341
346
|
3.11.0 / 2018-05-20
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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
|
|
346
351
|
|
|
347
352
|
3.10.0 / 2018-05-13
|
|
348
|
-
|
|
353
|
+
- Added support of cyrillic characters in parsing XML to JSON
|
|
349
354
|
|
|
350
355
|
3.9.11 / 2018-05-09
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
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
|
|
357
362
|
|
|
358
363
|
3.3.10 / 2018-04-23
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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
|
|
362
367
|
|
|
363
368
|
3.3.9 / 2018-04-18
|
|
364
|
-
|
|
369
|
+
- fix #74 : TS2314 TypeScript compiler error
|
|
365
370
|
|
|
366
371
|
3.3.8 / 2018-04-17
|
|
367
|
-
|
|
372
|
+
- fix #73 : IE doesn't support Object.assign
|
|
368
373
|
|
|
369
374
|
3.3.7 / 2018-04-14
|
|
370
|
-
|
|
371
|
-
|
|
375
|
+
- fix: use let insted of const in for loop of validator
|
|
376
|
+
- Merge pull request
|
|
372
377
|
https://github.com/NaturalIntelligence/fast-xml-parser/issues/71 from bb/master
|
|
373
378
|
first draft of typings for typescript
|
|
374
379
|
https://github.com/NaturalIntelligence/fast-xml-parser/issues/69
|
|
375
|
-
|
|
380
|
+
- Merge pull request
|
|
376
381
|
https://github.com/NaturalIntelligence/fast-xml-parser/issues/70 from bb/patch-1
|
|
377
382
|
fix some typos in readme
|
|
378
383
|
|
|
379
384
|
3.3.6 / 2018-03-21
|
|
380
|
-
|
|
385
|
+
- change arrow functions to full notation for IE compatibility
|
|
381
386
|
|
|
382
387
|
3.3.5 / 2018-03-15
|
|
383
|
-
|
|
384
|
-
|
|
388
|
+
- fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/67 : attrNodeName invalid behavior
|
|
389
|
+
- fix: remove decodeHTML char condition
|
|
385
390
|
|
|
386
391
|
3.3.4 / 2018-03-14
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
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.
|
|
390
395
|
|
|
391
396
|
3.3.0 / 2018-03-05
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
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
|
|
407
412
|
with more light opencollective-postinstall"
|
|
408
413
|
This reverts commit d47aa7181075d82db4fee97fd8ea32b056fe3f46.
|
|
409
|
-
|
|
414
|
+
- Merge pull request: https://github.com/NaturalIntelligence/fast-xml-parser/issues/63 from HaroldPutman/suppress-undefined
|
|
410
415
|
Keep undefined nodes out of the XML output : This is useful when you are deleting nodes from the JSON and rewriting XML.
|
|
411
416
|
|
|
412
417
|
3.2.4 / 2018-03-01
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
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
|
|
417
422
|
|
|
418
423
|
3.2.3 / 2018-02-28
|
|
419
|
-
|
|
424
|
+
- Merge pull request from Delagen/master: fix namespaces can contain the same characters as xml names
|
|
420
425
|
|
|
421
426
|
3.2.2 / 2018-02-22
|
|
422
|
-
|
|
423
|
-
|
|
427
|
+
- fix: attribute xmlns should not be removed if ignoreNameSpace is false
|
|
428
|
+
- create CONTRIBUTING.md
|
|
424
429
|
|
|
425
430
|
3.2.1 / 2018-02-17
|
|
426
|
-
|
|
431
|
+
- fix: empty attribute should be parsed
|
|
427
432
|
|
|
428
433
|
3.2.0 / 2018-02-16
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
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
|
|
440
445
|
- nested object
|
|
441
446
|
- array
|
|
442
447
|
- attributes
|
|
443
448
|
- text value
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
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
|
|
447
452
|
|
|
448
453
|
3.0.1 / 2018-02-09
|
|
449
|
-
|
|
454
|
+
- fix CRLF: replace it with single space in attributes value only.
|
|
450
455
|
|
|
451
456
|
3.0.0 / 2018-02-08
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
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
|
|
463
468
|
- handle multiple instances of CDATA
|
|
464
469
|
- make triming of value optionals
|
|
465
470
|
- HTML decode attribute and text value
|
|
466
471
|
- refactor code to separate files
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
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
|
|
477
482
|
2.9.4 / 2018-02-02
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
483
|
+
- Merge pull request: Decode HTML characters
|
|
484
|
+
- refactor source folder name
|
|
485
|
+
- ignore bundle / browser js to be published to npm
|
|
481
486
|
2.9.3 / 2018-01-26
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
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
|
|
487
492
|
2.9.2 / 2018-01-18
|
|
488
|
-
|
|
489
|
-
|
|
493
|
+
- Remove check if tag starting with "XML"
|
|
494
|
+
- Fix: when there are spaces before / after CDATA
|
|
490
495
|
|
|
491
496
|
2.9.1 / 2018-01-16
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
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
|
|
501
506
|
|
|
502
507
|
2.9.0 / 2018-01-10
|
|
503
|
-
|
|
508
|
+
- Rewrite the validator to handle large files.
|
|
504
509
|
Ignore DOCTYPE validation.
|
|
505
|
-
|
|
510
|
+
- Fix: When attribute value has equal sign
|
|
506
511
|
|
|
507
512
|
2.8.3 / 2017-12-15
|
|
508
|
-
|
|
513
|
+
- Fix: when a tag has value along with subtags
|
|
509
514
|
|
|
510
515
|
2.8.2 / 2017-12-04
|
|
511
|
-
|
|
516
|
+
- Fix value parsing for IE
|
|
512
517
|
|
|
513
518
|
2.8.1 / 2017-12-01
|
|
514
|
-
|
|
519
|
+
- fix: validator should return false instead of err when invalid XML
|
|
515
520
|
|
|
516
521
|
2.8.0 / 2017-11-29
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
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
|
|
525
530
|
|
|
526
531
|
2.7.4 / 2017-09-22
|
|
527
|
-
|
|
532
|
+
- Merge pull request: Allow wrap attributes with subobject to compatible with other parsers output
|
|
528
533
|
|
|
529
534
|
2.7.3 / 2017-08-02
|
|
530
|
-
|
|
535
|
+
- fix: handle CDATA with regx
|
|
531
536
|
|
|
532
537
|
2.7.2 / 2017-07-30
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
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
|
|
536
541
|
|
|
537
542
|
2.7.1 / 2017-07-26
|
|
538
|
-
|
|
543
|
+
- Fix: Handle val 0
|
|
539
544
|
|
|
540
545
|
2.7.0 / 2017-07-25
|
|
541
|
-
|
|
542
|
-
|
|
546
|
+
- Fix test for arrayMode
|
|
547
|
+
- Merge pull request: Add arrayMode option to parse any nodes as arrays
|
|
543
548
|
|
|
544
549
|
2.6.0 / 2017-07-14
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
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.
|
|
548
553
|
|
|
549
554
|
2.5.1 / 2017-07-01
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
555
|
+
- Fix XML element name pattern
|
|
556
|
+
- Fix XML element name pattern while parsing
|
|
557
|
+
- Fix validation for xml tag element
|
|
553
558
|
|
|
554
559
|
2.5.0 / 2017-06-25
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
560
|
+
- Improve Validator performance
|
|
561
|
+
- update attr matching regex
|
|
562
|
+
- Add perf tests
|
|
563
|
+
- Improve atrr regex to handle all cases
|
|
559
564
|
|
|
560
565
|
2.4.4 / 2017-06-08
|
|
561
|
-
|
|
566
|
+
- Bug fix: when an attribute has single or double quote in value
|
|
562
567
|
|
|
563
568
|
2.4.3 / 2017-06-05
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
569
|
+
- Bug fix: when multiple CDATA tags are given
|
|
570
|
+
- Merge pull request: add option "textNodeConversion"
|
|
571
|
+
- add option "textNodeConversion"
|
|
567
572
|
|
|
568
573
|
2.4.1 / 2017-04-14
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
574
|
+
- fix tests
|
|
575
|
+
- Bug fix: preserve initial space of node value
|
|
576
|
+
- Handle CDATA
|
|
572
577
|
|
|
573
578
|
2.3.1 / 2017-03-15
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
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
|
|
578
583
|
|
|
579
584
|
2.3.0 / 2017-02-26
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
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
|
|
587
592
|
|
|
588
593
|
2.2.1 / 2017-02-05
|
|
589
|
-
|
|
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
|
-
[](https://snyk.io/test/github/naturalintelligence/fast-xml-parser)
|
|
3
2
|
[![NPM quality][quality-image]][quality-url]
|
|
4
3
|
[](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
|
[](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
|
-
|
|
15
|
-
|
|
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="
|
|
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=
|
|
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="
|
|
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
|
+

|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
146
|
+
Bundle size
|
|
141
147
|
|
|
142
148
|
| Bundle Name | Size |
|
|
143
149
|
| ------------------ | ---- |
|
|
144
|
-
| fxbuilder.min.js |
|
|
145
|
-
| fxparser.js
|
|
146
|
-
|
|
|
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
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
-
|
|
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
|
-

|
|
172
|
-
* Y-axis: requests per second
|
|
173
|
-
* X-axis: File size
|
|
174
194
|
### XML Builder
|
|
175
195
|
|
|
176
|
-
|
|
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
|
-
[](https://github.com/NaturalIntelligence/ads/)
|
|
182
200
|
|
|
201
|
+
<!-- [](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
|
@@ -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;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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,
|
|
148
|
+
listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);
|
|
138
149
|
}
|
|
139
150
|
val += listTagVal;
|
|
140
151
|
} else {
|