node-red-contrib-tak-registration 0.7.2 → 0.8.0
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/README.md +1 -1
- package/node_modules/fast-xml-parser/CHANGELOG.md +561 -0
- package/node_modules/fast-xml-parser/README.md +134 -287
- package/node_modules/fast-xml-parser/package.json +17 -40
- package/node_modules/fast-xml-parser/{cli.js → src/cli/cli.js} +16 -24
- package/node_modules/fast-xml-parser/src/cli/man.js +12 -0
- package/node_modules/fast-xml-parser/src/fxp.d.ts +108 -0
- package/node_modules/fast-xml-parser/src/fxp.js +11 -0
- package/node_modules/fast-xml-parser/src/util.js +0 -36
- package/node_modules/fast-xml-parser/src/validator.js +15 -5
- package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +269 -0
- package/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +131 -0
- package/node_modules/fast-xml-parser/src/xmlbuilder/prettifyJs2Xml.js +0 -0
- package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +152 -0
- package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +48 -0
- package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +589 -0
- package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +58 -0
- package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +113 -0
- package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +25 -0
- package/package.json +2 -2
- package/tak-ingest.js +3 -2
- package/node_modules/fast-xml-parser/src/json2xml.js +0 -280
- package/node_modules/fast-xml-parser/src/nimndata.js +0 -144
- package/node_modules/fast-xml-parser/src/node2json.js +0 -42
- package/node_modules/fast-xml-parser/src/node2json_str.js +0 -63
- package/node_modules/fast-xml-parser/src/parser.d.ts +0 -79
- package/node_modules/fast-xml-parser/src/parser.js +0 -76
- package/node_modules/fast-xml-parser/src/xmlNode.js +0 -17
- package/node_modules/fast-xml-parser/src/xmlstr2xmlnode.js +0 -339
- /package/node_modules/fast-xml-parser/src/{read.js → cli/read.js} +0 -0
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
# [fast-xml-parser](https://www.npmjs.com/package/fast-xml-parser)
|
|
4
|
-
[](https://snyk.io/test/github/naturalintelligence/fast-xml-parser)
|
|
5
3
|
[![NPM quality][quality-image]][quality-url]
|
|
6
|
-
[](https://travis-ci.org/NaturalIntelligence/fast-xml-parser)
|
|
7
4
|
[](https://coveralls.io/github/NaturalIntelligence/fast-xml-parser?branch=master)
|
|
8
5
|
[<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/)
|
|
9
6
|
[](https://npm.im/fast-xml-parser)
|
|
@@ -12,323 +9,186 @@
|
|
|
12
9
|
[quality-url]: http://packagequality.com/#?package=fast-xml-parser
|
|
13
10
|
|
|
14
11
|
|
|
15
|
-
Validate XML, Parse XML to JS
|
|
12
|
+
Validate XML, Parse XML to JS Object, or Build XML from JS Object without C/C++ based libraries and no callback.
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-

|
|
14
|
+
<font size="6">I need a Career advice. I've posted the query on my <a href="github.com/amitguptagwl">profile</a>. Your support would be appreciable.</font>
|
|
20
15
|
|
|
16
|
+
Sponsor this project 👉
|
|
17
|
+
<a href="https://github.com/sponsors/NaturalIntelligence">
|
|
18
|
+
<img src="https://raw.githubusercontent.com/NaturalIntelligence/ThankYouBackers/main/github_sponsor.png" width="200" />
|
|
19
|
+
</a>
|
|
21
20
|
<a href="https://opencollective.com/fast-xml-parser/donate" target="_blank">
|
|
22
21
|
<img src="https://opencollective.com/fast-xml-parser/donate/button@2x.png?color=blue" width=200 />
|
|
23
22
|
</a>
|
|
24
23
|
<a href="https://paypal.me/naturalintelligence"> <img src="static/img/support_paypal.svg" alt="Stubmatic donate button" width="200"/></a>
|
|
25
24
|
|
|
26
|
-
Check [ThankYouBackers](https://github.com/NaturalIntelligence/ThankYouBackers) for our contributors
|
|
27
|
-
|
|
28
|
-
## Users
|
|
29
|
-
List of some applications/projects using Fast XML Parser. (Raise an issue to submit yours)
|
|
30
|
-
|
|
31
|
-
<a href="https://github.com/NaturalIntelligence/imglab" title="imglab" ><img src="https://github.com/NaturalIntelligence/imglab/blob/master/img/imglab_logo.png?raw=true" width="80px" ></a>
|
|
32
|
-
<a href="https://github.com/NaturalIntelligence/Stubmatic" title="stubmatic" ><img src="https://camo.githubusercontent.com/ff711425dc2286cd215637b7114eb43e571f001d/68747470733a2f2f6e61747572616c696e74656c6c6967656e63652e6769746875622e696f2f537475626d617469632f696d672f737475626d617469635f6c6f676f2e706e673f7261773d74727565" width="80px" ></a>
|
|
33
|
-
<a href="https://github.com/muneem4node/muneem" title="Muneem" ><img src="https://github.com/muneem4node/muneem/raw/master/static/muneem.png?raw=true" width="80px" ></a>
|
|
34
|
-
<a href="https://github.com/badges/shields" title="shields" ><img src="https://avatars2.githubusercontent.com/u/6254238" width="80px" ></a>
|
|
35
|
-
<a href="https://github.com/renovatebot/renovate" title="renovate" ><img src="https://avatars1.githubusercontent.com/u/38656520" width="80px" ></a>
|
|
36
|
-
<a href="https://vmware.com/" title="vmware" > <img src="https://avatars0.githubusercontent.com/u/473334" width="80px" ></a>
|
|
37
|
-
<a href="https://opensource.microsoft.com/" title="microsoft" > <img src="https://avatars0.githubusercontent.com/u/6154722" width="80px" ></a>
|
|
38
|
-
<a href="https://github.com/notable/notable" title="notable" > <img src="https://avatars3.githubusercontent.com/u/46467536" width="80px" ></a>
|
|
39
|
-
<a href="http://ibm.github.io/" title="IBM" > <img src="https://avatars2.githubusercontent.com/u/1459110" width="80px" ></a>
|
|
40
|
-
<a href="https://www.ft.com/" title="Financial Times" > <img src="https://avatars2.githubusercontent.com/u/3502508" width="80px" ></a>
|
|
41
|
-
<a href="https://github.com/camunda" title="camunda BPM" > <img src="https://avatars3.githubusercontent.com/u/2443838" width="80px" ></a>
|
|
42
|
-
<a href="https://github.com/AnyChart" title="AnyChart" > <img src="https://avatars0.githubusercontent.com/u/703373" width="80px" ></a>
|
|
43
|
-
<a href="https://github.com/magda-io" title="magda-io" > <img src="https://avatars0.githubusercontent.com/u/40348684" width="80px" ></a>
|
|
44
|
-
<a href="https://github.com/geistinteractive" title="Geist Interactive" > <img src="https://avatars0.githubusercontent.com/u/11617965" width="80px" ></a>
|
|
45
|
-
<a href="https://www.tourstream.eu/" title="tourstream" > <img src="https://avatars1.githubusercontent.com/u/23242088" width="80px" ></a>
|
|
46
|
-
<a href="https://www.atomist.com/" title="Atomist" > <img src="https://avatars3.githubusercontent.com/u/19392" width="80px" ></a>
|
|
47
|
-
<a href="http://www.opuscapita.com/" title="OpusCapita" > <img src="https://avatars1.githubusercontent.com/u/23256480" width="80px" ></a>
|
|
48
|
-
<a href="https://nevatrip.ru/" title="nevatrip" > <img src="https://avatars2.githubusercontent.com/u/35730984" width="80px" ></a>
|
|
49
|
-
<a href="http://www.smartbear.com" title="SmartBear Software" > <img src="https://avatars2.githubusercontent.com/u/1644671" width="80px" ></a>
|
|
50
|
-
<a href="http://eosnavigator.com/" title="nevatrip" > <img src="https://avatars1.githubusercontent.com/u/40260563" width="80px" ></a>
|
|
51
|
-
<a href="http://nasa.github.io/" title="NASA" > <img src="https://avatars0.githubusercontent.com/u/848102" width="80px" ></a>
|
|
52
|
-
<a href="http://qgis.org/" title="QGIS" > <img src="https://avatars2.githubusercontent.com/u/483444" width="80px" ></a>
|
|
53
|
-
<a href="http://www.craft.ai/" title="craft ai" > <img src="https://avatars1.githubusercontent.com/u/12046764" width="80px" ></a>
|
|
54
|
-
<a href="http://brownspace.org/" title="Brown Space Engineering" > <img src="https://avatars2.githubusercontent.com/u/5504507" width="80px" ></a>
|
|
55
|
-
<a href="http://www.appcelerator.com/" title="Team Appcelerator" > <img src="https://avatars1.githubusercontent.com/u/82188" width="80px" ></a>
|
|
56
|
-
<a href="https://xmllint.com/" title="XML Lint" > <img src="https://xmllint.com/assets/logo.png" width="80px" ></a>
|
|
57
|
-
<a href="https://github.com/prettier" title="Prettier" > <img src="https://avatars0.githubusercontent.com/u/25822731" width="80px" ></a>
|
|
58
|
-
<a href="https://github.com/dolanmiu/docx" title="docx" > <img src="https://i.imgur.com/37uBGhO.gif" width="80px" ></a>
|
|
59
|
-
<a href="http://orange-opensource.github.io/" title="Open Source by Orange" > <img src="https://avatars3.githubusercontent.com/u/1506386" width="80px" ></a>
|
|
60
|
-
<a href="http://www.ybrain.com/" title="YBRAIN Inc." > <img src="https://avatars2.githubusercontent.com/u/38232440" width="80px" ></a>
|
|
61
|
-
<a href="http://99bitcoins.com/" title="99 bitcoins" > <img src="https://avatars0.githubusercontent.com/u/9527779" width="80px" ></a>
|
|
62
|
-
<a href="https://wechaty.github.io/wechaty/" title="Wechaty" > <img src="https://avatars0.githubusercontent.com/u/21285357" width="80px" ></a>
|
|
63
|
-
<a href="https://opendatakit.org" title="Open Data Kit" > <img src="https://avatars0.githubusercontent.com/u/6222985" width="80px" ></a>
|
|
64
|
-
<a href="https://ridibooks.com" title="RIDI Books" > <img src="https://avatars1.githubusercontent.com/u/24955411" width="80px" ></a>
|
|
65
|
-
<a href="http://signalk.org" title="Signal K" > <img src="https://avatars1.githubusercontent.com/u/7126740" width="80px" ></a>
|
|
66
|
-
<a href="http://brain.js.org/" title="brain.js" > <img src="https://avatars2.githubusercontent.com/u/23732838" width="80px" ></a>
|
|
67
|
-
<a href="https://skygear.io/" title="Skegear" > <img src="https://avatars1.githubusercontent.com/u/15025887" width="80px" ></a>
|
|
68
|
-
<a href="https://npmjs.com/" title="npm" > <img src="https://avatars0.githubusercontent.com/u/6078720" width="80px" ></a>
|
|
69
|
-
<a href=" https://www.mindpointgroup.com" title="mindpointgroup" > <img src="https://avatars1.githubusercontent.com/u/6413533" width="80px" ></a>
|
|
70
|
-
<a href="http://www.acuantcorp.com/" title="Acuant Inc" > <img src="https://avatars3.githubusercontent.com/u/11580319?s=200&v=4" width="80px" ></a>
|
|
71
|
-
<a href="https://www.wazuh.com/" title="wazuh" > <img src="https://avatars2.githubusercontent.com/u/13752566" width="80px" ></a>
|
|
72
|
-
<a href="https://orbs.com/" title="ORBS The Hybrid Blockchain" > <img src="https://avatars1.githubusercontent.com/u/33665977" width="80px" ></a>
|
|
73
|
-
<a href="https://texlab.netlify.com/" title="latex-lsp" > <img src="https://avatars1.githubusercontent.com/u/48360002" width="80px" ></a>
|
|
74
|
-
<a href="https://frontside.io/" title="The Frontside " > <img src="https://avatars1.githubusercontent.com/u/223096" width="80px" ></a>
|
|
75
|
-
<a href="https://creditsense.com.au/" title="Credit Sense Australia " > <img src="https://avatars0.githubusercontent.com/u/46947118" width="80px" ></a>
|
|
76
|
-
<a href="https://www.hustunique.com/" title="UniqueStudio" > <img src="https://avatars1.githubusercontent.com/u/4847684" width="80px" ></a>
|
|
77
|
-
<a href="http://www.openforis.org/" title="Open Foris" > <img src="https://avatars2.githubusercontent.com/u/1212750" width="80px" ></a>
|
|
78
|
-
<a href="#" title="NHS Connect" > <img src="https://avatars3.githubusercontent.com/u/20316669" width="80px" ></a>
|
|
79
|
-
<a href="https://tradle.io/" title="Tradle" > <img src="https://avatars2.githubusercontent.com/u/9482126" width="80px" ></a>
|
|
80
|
-
<a href="http://www.anl.gov/" title="Argonne National Laboratory" > <img src="https://avatars0.githubusercontent.com/u/10468712" width="80px" ></a>
|
|
81
|
-
<a href="https://simpleicons.org/" title="Simple Icons" > <img src="https://avatars2.githubusercontent.com/u/29872746" width="80px" ></a>
|
|
82
|
-
<a href="https://stoplight.io/" title="Stoplight" > <img src="https://avatars1.githubusercontent.com/u/10767217" width="80px" ></a>
|
|
83
|
-
<a href="http://www.fda.gov/" title="Food and Drug Administration " > <img src="https://avatars2.githubusercontent.com/u/6471964" width="80px" ></a>
|
|
84
|
-
<a href="http://www.magento.com/" title="Magento" > <img src="https://avatars2.githubusercontent.com/u/168457" width="80px" ></a>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
The list of users is collected either from the list published by Github, cummunicated 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.
|
|
88
|
-
|
|
89
|
-
### Main Features
|
|
90
25
|
|
|
91
|
-
|
|
26
|
+
### Current Sponsors
|
|
92
27
|
|
|
93
|
-
|
|
94
|
-
* Transform XML to JSON or Nimn
|
|
95
|
-
* Transform JSON back to XML
|
|
96
|
-
* Works with node packages, in browser, and in CLI (press try me button above for demo)
|
|
97
|
-
* Faster than any pure JS implementation.
|
|
98
|
-
* It can handle big files (tested up to 100mb).
|
|
99
|
-
* Various options are available to customize the transformation
|
|
100
|
-
* You can parse CDATA as a separate property.
|
|
101
|
-
* You can prefix attributes or group them to a separate property. Or they can be ignored from the result completely.
|
|
102
|
-
* You can parse tag's or attribute's value to primitive type: string, integer, float, hexadecimal, or boolean. And can optionally decode for HTML char.
|
|
103
|
-
* You can remove namespace from tag or attribute name while parsing
|
|
104
|
-
* It supports boolean attributes, if configured.
|
|
28
|
+
Check the complete list at [ThankYouBackers](https://github.com/NaturalIntelligence/ThankYouBackers) for our sponsors and supporters.
|
|
105
29
|
|
|
106
|
-
|
|
30
|
+
Through Github
|
|
107
31
|
|
|
108
|
-
|
|
32
|
+
<a href="https://github.com/getsentry" target="_blank"><img src="https://user-images.githubusercontent.com/7692328/204701653-ce369b29-6fdb-48f2-9848-593d04628a2b.png" width="60px"></a>
|
|
109
33
|
|
|
110
|
-
|
|
34
|
+
Through OpenCollective
|
|
111
35
|
|
|
112
|
-
|
|
36
|
+
<a href="https://opencollective.com/fast-xml-parser/sponsor/0/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/0/avatar.svg"></a>
|
|
37
|
+
<a href="https://opencollective.com/fast-xml-parser/sponsor/1/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/1/avatar.svg"></a>
|
|
38
|
+
<a href="https://opencollective.com/fast-xml-parser/sponsor/2/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/2/avatar.svg"></a>
|
|
39
|
+
<a href="https://opencollective.com/fast-xml-parser/sponsor/3/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/3/avatar.svg"></a>
|
|
40
|
+
<a href="https://opencollective.com/fast-xml-parser/sponsor/4/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/4/avatar.svg"></a>
|
|
41
|
+
<a href="https://opencollective.com/fast-xml-parser/sponsor/5/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/5/avatar.svg"></a>
|
|
42
|
+
<a href="https://opencollective.com/fast-xml-parser/sponsor/6/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/6/avatar.svg"></a>
|
|
43
|
+
<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>
|
|
44
|
+
<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>
|
|
45
|
+
<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>
|
|
113
46
|
|
|
114
|
-
Or using [yarn](https://yarnpkg.com/):
|
|
115
47
|
|
|
116
|
-
|
|
48
|
+
## Users
|
|
117
49
|
|
|
118
|
-
|
|
50
|
+
<a href="https://github.com/renovatebot/renovate" title="renovate" ><img src="https://avatars1.githubusercontent.com/u/38656520" width="60px" ></a>
|
|
51
|
+
<a href="https://vmware.com/" title="vmware" > <img src="https://avatars0.githubusercontent.com/u/473334" width="60px" ></a>
|
|
52
|
+
<a href="https://opensource.microsoft.com/" title="microsoft" > <img src="https://avatars0.githubusercontent.com/u/6154722" width="60px" ></a>
|
|
53
|
+
<a href="http://ibm.github.io/" title="IBM" > <img src="https://avatars2.githubusercontent.com/u/1459110" width="60px" ></a>
|
|
54
|
+
<a href="http://www.smartbear.com" title="SmartBear Software" > <img src="https://avatars2.githubusercontent.com/u/1644671" width="60px" ></a>
|
|
55
|
+
<a href="http://nasa.github.io/" title="NASA" > <img src="https://avatars0.githubusercontent.com/u/848102" width="60px" ></a>
|
|
56
|
+
<a href="https://github.com/prettier" title="Prettier" > <img src="https://avatars0.githubusercontent.com/u/25822731" width="60px" ></a>
|
|
57
|
+
<a href="http://brain.js.org/" title="brain.js" > <img src="https://avatars2.githubusercontent.com/u/23732838" width="60px" ></a>
|
|
58
|
+
<a href="https://github.com/aws" title="AWS SDK" > <img src="https://avatars.githubusercontent.com/u/2232217" width="60px" ></a>
|
|
59
|
+
<a href="http://www.fda.gov/" title="Food and Drug Administration " > <img src="https://avatars2.githubusercontent.com/u/6471964" width="60px" ></a>
|
|
60
|
+
<a href="http://www.magento.com/" title="Magento" > <img src="https://avatars2.githubusercontent.com/u/168457" width="60px" ></a>
|
|
61
|
+
<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>
|
|
62
|
+
<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>
|
|
63
|
+
<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>
|
|
119
64
|
|
|
120
|
-
|
|
65
|
+
Check the bigger [list](./USERs.md)
|
|
121
66
|
|
|
122
|
-
|
|
67
|
+
<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>
|
|
123
68
|
|
|
124
|
-
|
|
69
|
+
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
|
|
70
|
+
- githubissues@proton.me
|
|
71
|
+
- https://linkedin.com/in/amitguptagwl/
|
|
125
72
|
|
|
73
|
+
## Main Features
|
|
126
74
|
|
|
127
|
-
|
|
128
|
-
const jsonObj = parser.parse(xmlData [,options] );
|
|
129
|
-
```
|
|
75
|
+
<img align="right" src="static/img/fxp_logo.png" width="180px" alt="FXP logo"/>
|
|
130
76
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
cdataPositionChar: "\\c",
|
|
147
|
-
parseTrueNumberOnly: false,
|
|
148
|
-
numParseOptions:{
|
|
149
|
-
hex: true,
|
|
150
|
-
leadingZeros: true,
|
|
151
|
-
//skipLike: /\+[0-9]{10}/
|
|
152
|
-
},
|
|
153
|
-
arrayMode: false, //"strict"
|
|
154
|
-
attrValueProcessor: (val, attrName) => he.decode(val, {isAttributeValue: true}),//default is a=>a
|
|
155
|
-
tagValueProcessor : (val, tagName) => he.decode(val), //default is a=>a
|
|
156
|
-
stopNodes: ["parse-me-as-string"],
|
|
157
|
-
alwaysCreateTextNode: false
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
if( parser.validate(xmlData) === true) { //optional (it'll return an object in case it's not valid)
|
|
161
|
-
let jsonObj = parser.parse(xmlData,options);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Intermediate obj
|
|
165
|
-
const tObj = parser.getTraversalObj(xmlData,options);
|
|
166
|
-
let jsonObj = parser.convertToJson(tObj,options);
|
|
77
|
+
* Validate XML data syntactically
|
|
78
|
+
* Parse XML to JS Object
|
|
79
|
+
* Build XML from JS Object
|
|
80
|
+
* Works with node packages, in browser, and in CLI (press try me button above for demo)
|
|
81
|
+
* Faster than any other pure JS implementation.
|
|
82
|
+
* It can handle big files (tested up to 100mb).
|
|
83
|
+
* Controlled parsing using various options
|
|
84
|
+
* XML Entities, HTML entities, and DOCTYPE entites are supported.
|
|
85
|
+
* unpaired tags (Eg `<br>` in HTML), stop nodes (Eg `<script>` in HTML) are supported.
|
|
86
|
+
* You can restore almost same XML from JSON
|
|
87
|
+
* Supports comments
|
|
88
|
+
* It can preserve Order of tags in JS object
|
|
89
|
+
* You can control if a single tag should be parsed into array.
|
|
90
|
+
* Supports parsing of PI (Processing Instruction) tags with XML declaration tags
|
|
91
|
+
* And many more other features.
|
|
167
92
|
|
|
168
|
-
|
|
169
|
-
As you can notice in the above code, validator is not embedded with in the parser and expected to be called separately. However, you can pass `true` or validation options as 3rd parameter to the parser to trigger validator internally. It is same as above example.
|
|
93
|
+
## How to use
|
|
170
94
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
console.log(error.message)
|
|
176
|
-
}
|
|
177
|
-
```
|
|
95
|
+
To use as package dependency
|
|
96
|
+
`$ npm install fast-xml-parser`
|
|
97
|
+
or
|
|
98
|
+
`$ yarn add fast-xml-parser`
|
|
178
99
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
err: {
|
|
183
|
-
code: code,
|
|
184
|
-
msg: message,
|
|
185
|
-
line: lineNumber,
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
```
|
|
100
|
+
To use as system command
|
|
101
|
+
`$ npm install fast-xml-parser -g`
|
|
189
102
|
|
|
103
|
+
To use it on a **webpage** include it from a [CDN](https://cdnjs.com/libraries/fast-xml-parser)
|
|
190
104
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
<details>
|
|
194
|
-
<summary>OPTIONS :</summary>
|
|
195
|
-
|
|
196
|
-
* **attributeNamePrefix** : prepend given string to attribute name for identification
|
|
197
|
-
* **attrNodeName**: (Valid name) Group all the attributes as properties of given name.
|
|
198
|
-
* **ignoreAttributes** : Ignore attributes to be parsed.
|
|
199
|
-
* **ignoreNameSpace** : Remove namespace string from tag and attribute names.
|
|
200
|
-
* **allowBooleanAttributes** : a tag can have attributes without any value
|
|
201
|
-
* **parseNodeValue** : Parse the value of text node to float, integer, or boolean.
|
|
202
|
-
* **parseAttributeValue** : Parse the value of an attribute to float, integer, or boolean.
|
|
203
|
-
* **trimValues** : trim string values of an attribute or node
|
|
204
|
-
* **decodeHTMLchar** : This options has been removed from 3.3.4. Instead, use tagValueProcessor, and attrValueProcessor. See above example.
|
|
205
|
-
* **cdataTagName** : If specified, parser parse CDATA as nested tag instead of adding it's value to parent tag.
|
|
206
|
-
* **cdataPositionChar** : It'll help to covert JSON back to XML without losing CDATA position.
|
|
207
|
-
* **parseTrueNumberOnly**: if true then values like "+123", or "0123" will not be parsed as number.
|
|
208
|
-
* **arrayMode** : When `false`, a tag with single occurrence is parsed as an object but as an array in case of multiple occurences. When `true`, a tag will be parsed as an array always excluding leaf nodes. When `strict`, all the tags will be parsed as array only. When instance of `RegEx`, only tags will be parsed as array that match the regex. When `function` a tag name is passed to the callback that can be checked.
|
|
209
|
-
* **tagValueProcessor** : Process tag value during transformation. Like HTML decoding, word capitalization, etc. Applicable in case of string only.
|
|
210
|
-
* **attrValueProcessor** : Process attribute value during transformation. Like HTML decoding, word capitalization, etc. Applicable in case of string only.
|
|
211
|
-
* **stopNodes** : an array of tag names which are not required to be parsed. Instead their values are parsed as string.
|
|
212
|
-
* **alwaysCreateTextNode** : When `true`, forces the parser always return a property for the `textNodeName` even if there are no attributes or node children.
|
|
213
|
-
</details>
|
|
214
|
-
|
|
215
|
-
<details>
|
|
216
|
-
<summary>To use from <b>command line</b></summary>
|
|
105
|
+
**Example**
|
|
217
106
|
|
|
107
|
+
As CLI command
|
|
218
108
|
```bash
|
|
219
|
-
$
|
|
220
|
-
$cat xmlfile.xml | xml2js [-ns|-a|-c|-v|-V] [-o outputfile.json]
|
|
109
|
+
$ fxparser some.xml
|
|
221
110
|
```
|
|
222
111
|
|
|
223
|
-
|
|
224
|
-
* -a : To ignore attributes
|
|
225
|
-
* -c : To ignore value conversion (i.e. "-3" will not be converted to number -3)
|
|
226
|
-
* -v : validate before parsing
|
|
227
|
-
* -V : only validate
|
|
228
|
-
</details>
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
<details>
|
|
232
|
-
<summary>To use it <b>on webpage</b></summary>
|
|
233
|
-
|
|
112
|
+
In a node js project
|
|
234
113
|
```js
|
|
235
|
-
const
|
|
236
|
-
if (result !== true) console.log(result.err);
|
|
237
|
-
const jsonObj = parser.parse(xmlData);
|
|
238
|
-
```
|
|
239
|
-
</details>
|
|
114
|
+
const { XMLParser, XMLBuilder, XMLValidator} = require("fast-xml-parser");
|
|
240
115
|
|
|
241
|
-
|
|
116
|
+
const parser = new XMLParser();
|
|
117
|
+
let jObj = parser.parse(XMLdata);
|
|
242
118
|
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
//default options need not to set
|
|
246
|
-
const defaultOptions = {
|
|
247
|
-
attributeNamePrefix : "@_",
|
|
248
|
-
attrNodeName: "@", //default is false
|
|
249
|
-
textNodeName : "#text",
|
|
250
|
-
ignoreAttributes : true,
|
|
251
|
-
cdataTagName: "__cdata", //default is false
|
|
252
|
-
cdataPositionChar: "\\c",
|
|
253
|
-
format: false,
|
|
254
|
-
indentBy: " ",
|
|
255
|
-
supressEmptyNode: false,
|
|
256
|
-
tagValueProcessor: a=> he.encode(a, { useNamedReferences: true}),// default is a=>a
|
|
257
|
-
attrValueProcessor: a=> he.encode(a, {isAttributeValue: isAttribute, useNamedReferences: true}),// default is a=>a
|
|
258
|
-
rootNodeName: "element"
|
|
259
|
-
};
|
|
260
|
-
const parser = new Parser(defaultOptions);
|
|
261
|
-
const xml = parser.parse(json_or_js_obj);
|
|
119
|
+
const builder = new XMLBuilder();
|
|
120
|
+
const xmlContent = builder.build(jObj);
|
|
262
121
|
```
|
|
263
122
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
* **cdataTagName** : If specified, parse matching tag as CDATA
|
|
274
|
-
* **cdataPositionChar** : Identify the position where CDATA tag should be placed. If it is blank then CDATA will be added in the last of tag's value.
|
|
275
|
-
* **format** : If set to true, then format the XML output.
|
|
276
|
-
* **indentBy** : indent by this char `when` format is set to `true`
|
|
277
|
-
* **supressEmptyNode** : If set to `true`, tags with no value (text or nested tags) are written as self closing tags.
|
|
278
|
-
* **tagValueProcessor** : Process tag value during transformation. Like HTML encoding, word capitalization, etc. Applicable in case of string only.
|
|
279
|
-
* **attrValueProcessor** : Process attribute value during transformation. Like HTML encoding, word capitalization, etc. Applicable in case of string only.
|
|
280
|
-
* **rootNodeName** : When input js object is array, parser uses array index by default as tag name. You can set this property for proper response.
|
|
281
|
-
</details>
|
|
282
|
-
|
|
283
|
-
## Benchmark
|
|
284
|
-
|
|
285
|
-
#### XML to JSON
|
|
286
|
-
|
|
287
|
-

|
|
123
|
+
In a HTML page
|
|
124
|
+
```html
|
|
125
|
+
<script src="path/to/fxp.min.js"></script>
|
|
126
|
+
:
|
|
127
|
+
<script>
|
|
128
|
+
const parser = new fxparser.XMLParser();
|
|
129
|
+
parser.parse(xmlContent);
|
|
130
|
+
</script>
|
|
131
|
+
```
|
|
288
132
|
|
|
289
|
-
|
|
290
|
-
<summary>report</summary>
|
|
133
|
+
Check lib folder for different browser bundles
|
|
291
134
|
|
|
292
|
-
|
|
|
293
|
-
|
|
|
294
|
-
|
|
|
295
|
-
|
|
|
296
|
-
|
|
|
297
|
-
|
|
|
298
|
-
|
|
|
299
|
-
| 1.6k with cdata,prolog,doctype | 27690.26082 | 41433.98547 | 7872.399268 |
|
|
300
|
-
| 98m | 0.08473858148 | 0.2600104004 | -1 |
|
|
135
|
+
| Bundle Name | Size |
|
|
136
|
+
| ------------------ | ---- |
|
|
137
|
+
| fxbuilder.min.js | 5.2K |
|
|
138
|
+
| fxparser.js | 50K |
|
|
139
|
+
| fxparser.min.js | 17K |
|
|
140
|
+
| fxp.min.js | 22K |
|
|
141
|
+
| fxvalidator.min.js | 5.7K |
|
|
301
142
|
|
|
302
|
-
|
|
303
|
-
|
|
143
|
+
### Documents
|
|
144
|
+
**v3**
|
|
145
|
+
* [documents](./docs/v3/docs.md)
|
|
304
146
|
|
|
147
|
+
**v4**
|
|
148
|
+
1. [GettingStarted.md](./docs/v4/1.GettingStarted.md)
|
|
149
|
+
2. [XML Parser](./docs/v4/2.XMLparseOptions.md)
|
|
150
|
+
3. [XML Builder](./docs/v4/3.XMLBuilder.md)
|
|
151
|
+
4. [XML Validator](./docs/v4/4.XMLValidator.md)
|
|
152
|
+
5. [Entities](./docs/v4/5.Entities.md)
|
|
153
|
+
6. [HTML Document Parsing](./docs/v4/6.HTMLParsing.md)
|
|
154
|
+
7. [PI Tag processing](./docs/v4/7.PITags.md)
|
|
155
|
+
## Performance
|
|
305
156
|
|
|
306
|
-
|
|
157
|
+
### XML Parser
|
|
307
158
|
|
|
308
|
-

|
|
160
|
+
* Y-axis: requests per second
|
|
161
|
+
* X-axis: File size
|
|
309
162
|
|
|
310
|
-
|
|
311
|
-
|
|
163
|
+
**Large files**
|
|
164
|
+

|
|
165
|
+
* Y-axis: requests per second
|
|
166
|
+
* X-axis: File size
|
|
167
|
+
### XML Builder
|
|
312
168
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
| 1.3k | 160148.9801 | 10384.99401|
|
|
316
|
-
| 1.1m | 173.6374831 | 8.611884025|
|
|
169
|
+

|
|
170
|
+
* Y-axis: requests per second
|
|
317
171
|
|
|
318
|
-
</
|
|
172
|
+
<small>negative means error</small>
|
|
319
173
|
|
|
320
|
-
|
|
174
|
+
[](https://github.com/NaturalIntelligence/ads/)
|
|
321
175
|
|
|
322
|
-
|
|
323
|
-
- **[imglab](https://github.com/NaturalIntelligence/imglab)** : Speedup and simplify image labeling / annotation. Supports multiple formats, one click annotation, easy interface and much more. There are more than half million images are being annotated every month using this tool.
|
|
324
|
-
- [stubmatic](https://github.com/NaturalIntelligence/Stubmatic) : Create fake webservices, DynamoDB or S3 servers, Manage fake/mock stub data, Or fake any HTTP(s) call.
|
|
325
|
-
- **[अनुमार्गक (anumargak)](https://github.com/NaturalIntelligence/anumargak)** : The fastest and simple router for node js web frameworks with many unique features.
|
|
326
|
-
- [मुनीम (Muneem)](https://github.com/muneem4node/muneem) : A webframework made for all team members. Fast and Featured.
|
|
327
|
-
- [शब्दावली (shabdawali)](https://github.com/amitguptagwl/shabdawali) : Amazing human like typing effects beyond your imagination.
|
|
176
|
+
## Our other projects and research you must try
|
|
328
177
|
|
|
178
|
+
* **[BigBit standard](https://github.com/amitguptagwl/bigbit)** :
|
|
179
|
+
* Single text encoding to replace UTF-8, UTF-16, UTF-32 and more with less memory.
|
|
180
|
+
* Single Numeric datatype alternative of integer, float, double, long, decimal and more without precision loss.
|
|
181
|
+
* **[Cytorus](https://github.com/NaturalIntelligence/cytorus)**: Be specific and flexible while running E2E tests.
|
|
182
|
+
* Run tests only for a particular User Story
|
|
183
|
+
* Run tests for a route or from a route
|
|
184
|
+
* Customizable reporting
|
|
185
|
+
* Central dashboard for better monitoring
|
|
186
|
+
* Options to integrate E2E tests with Jira, Github etc using Central dashboard `Tian`.
|
|
187
|
+
* **[Stubmatic](https://github.com/NaturalIntelligence/Stubmatic)** : Create fake webservices, DynamoDB or S3 servers, Manage fake/mock stub data, Or fake any HTTP(s) call.
|
|
329
188
|
|
|
330
189
|
|
|
331
|
-
##
|
|
190
|
+
## Supporters
|
|
191
|
+
### Contributors
|
|
332
192
|
|
|
333
193
|
This project exists thanks to [all](graphs/contributors) the people who contribute. [[Contribute](docs/CONTRIBUTING.md)].
|
|
334
194
|
<!-- <a href="graphs/contributors"><img src="https://opencollective.com/fast-xml-parser/contributors.svg?width=890&button=false" /></a> -->
|
|
@@ -340,28 +200,15 @@ This project exists thanks to [all](graphs/contributors) the people who contribu
|
|
|
340
200
|
### All Contributors -->
|
|
341
201
|
<a href="graphs/contributors"><img src="https://opencollective.com/fast-xml-parser/contributors.svg?width=890&button=false" /></a>
|
|
342
202
|
|
|
343
|
-
|
|
203
|
+
### Backers
|
|
344
204
|
|
|
345
205
|
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/fast-xml-parser#backer)]
|
|
346
206
|
|
|
347
207
|
<a href="https://opencollective.com/fast-xml-parser#backers" target="_blank"><img src="https://opencollective.com/fast-xml-parser/backers.svg?width=890"></a>
|
|
348
208
|
|
|
349
209
|
|
|
350
|
-
## Sponsors
|
|
351
|
-
|
|
352
|
-
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/fast-xml-parser#sponsor)]
|
|
353
|
-
|
|
354
|
-
<a href="https://opencollective.com/fast-xml-parser/sponsor/0/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/0/avatar.svg"></a>
|
|
355
|
-
<a href="https://opencollective.com/fast-xml-parser/sponsor/1/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/1/avatar.svg"></a>
|
|
356
|
-
<a href="https://opencollective.com/fast-xml-parser/sponsor/2/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/2/avatar.svg"></a>
|
|
357
|
-
<a href="https://opencollective.com/fast-xml-parser/sponsor/3/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/3/avatar.svg"></a>
|
|
358
|
-
<a href="https://opencollective.com/fast-xml-parser/sponsor/4/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/4/avatar.svg"></a>
|
|
359
|
-
<a href="https://opencollective.com/fast-xml-parser/sponsor/5/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/5/avatar.svg"></a>
|
|
360
|
-
<a href="https://opencollective.com/fast-xml-parser/sponsor/6/website" target="_blank"><img src="https://opencollective.com/fast-xml-parser/sponsor/6/avatar.svg"></a>
|
|
361
|
-
<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>
|
|
362
|
-
<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>
|
|
363
|
-
<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>
|
|
364
210
|
|
|
365
211
|
# License
|
|
366
|
-
|
|
367
212
|
* MIT License
|
|
213
|
+
|
|
214
|
+

|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fast-xml-parser",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Validate XML
|
|
5
|
-
"main": "./src/
|
|
3
|
+
"version": "4.2.7",
|
|
4
|
+
"description": "Validate XML, Parse XML, Build XML without C/C++ based libraries",
|
|
5
|
+
"main": "./src/fxp.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "nyc --reporter=lcov --reporter=text jasmine spec/*spec.js",
|
|
8
8
|
"unit": "jasmine",
|
|
9
9
|
"coverage": "nyc report --reporter html --reporter text -t .nyc_output --report-dir .nyc_output/summary",
|
|
10
10
|
"perf": "node ./benchmark/perfTest3.js",
|
|
11
11
|
"lint": "eslint src/*.js spec/*.js",
|
|
12
|
-
"bundle": "webpack
|
|
12
|
+
"bundle": "webpack --config webpack-prod.config.js",
|
|
13
13
|
"prettier": "prettier --write src/**/*.js",
|
|
14
14
|
"publish-please": "publish-please",
|
|
15
15
|
"checkReadiness": "publish-please --dry-run"
|
|
16
16
|
},
|
|
17
17
|
"bin": {
|
|
18
|
-
"
|
|
18
|
+
"fxparser": "./src/cli/cli.js"
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
@@ -30,42 +30,16 @@
|
|
|
30
30
|
"x2js",
|
|
31
31
|
"xml2json",
|
|
32
32
|
"js",
|
|
33
|
-
"traversable",
|
|
34
33
|
"cli",
|
|
35
|
-
"command",
|
|
36
34
|
"validator",
|
|
37
35
|
"validate",
|
|
38
36
|
"transformer",
|
|
39
|
-
"checker",
|
|
40
37
|
"assert",
|
|
41
|
-
"big",
|
|
42
38
|
"js2xml",
|
|
43
39
|
"json2xml",
|
|
44
|
-
"nimn",
|
|
45
|
-
"xml2nimn",
|
|
46
|
-
"locale",
|
|
47
40
|
"html"
|
|
48
41
|
],
|
|
49
|
-
"author": "Amit Gupta (https://
|
|
50
|
-
"contributors": [
|
|
51
|
-
{
|
|
52
|
-
"name": "Alfonso Muñoz-Pomer Fuentes",
|
|
53
|
-
"email": "amunoz@ebi.ac.uk",
|
|
54
|
-
"url": "https://github.com/alfonsomunozpomer"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"name": "Steve Reichenbach",
|
|
58
|
-
"url": "https://github.com/EyesOnlyNet"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"name": "Vohmyanin Sergey Vasilevich",
|
|
62
|
-
"url": "http://delagen.livejournal.com"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"name": "Andrew Udvare",
|
|
66
|
-
"url": "https://github.com/Tatsh"
|
|
67
|
-
}
|
|
68
|
-
],
|
|
42
|
+
"author": "Amit Gupta (https://amitguptagwl.github.io)",
|
|
69
43
|
"license": "MIT",
|
|
70
44
|
"devDependencies": {
|
|
71
45
|
"@babel/core": "^7.13.10",
|
|
@@ -73,22 +47,25 @@
|
|
|
73
47
|
"@babel/preset-env": "^7.13.10",
|
|
74
48
|
"@babel/register": "^7.13.8",
|
|
75
49
|
"babel-loader": "^8.2.2",
|
|
76
|
-
"
|
|
50
|
+
"cytorus": "^0.2.9",
|
|
51
|
+
"eslint": "^8.3.0",
|
|
77
52
|
"he": "^1.2.0",
|
|
78
53
|
"jasmine": "^3.6.4",
|
|
79
|
-
"nimnjs": "^1.3.2",
|
|
80
54
|
"nyc": "^15.1.0",
|
|
81
55
|
"prettier": "^1.19.1",
|
|
82
56
|
"publish-please": "^5.5.2",
|
|
83
|
-
"webpack": "^
|
|
84
|
-
"webpack-cli": "^
|
|
57
|
+
"webpack": "^5.64.4",
|
|
58
|
+
"webpack-cli": "^4.9.1"
|
|
85
59
|
},
|
|
86
|
-
"typings": "src/
|
|
87
|
-
"funding": {
|
|
60
|
+
"typings": "src/fxp.d.ts",
|
|
61
|
+
"funding": [{
|
|
88
62
|
"type": "paypal",
|
|
89
63
|
"url": "https://paypal.me/naturalintelligence"
|
|
90
|
-
},
|
|
64
|
+
},{
|
|
65
|
+
"type": "github",
|
|
66
|
+
"url": "https://github.com/sponsors/NaturalIntelligence"
|
|
67
|
+
}],
|
|
91
68
|
"dependencies": {
|
|
92
|
-
"strnum": "^1.0.
|
|
69
|
+
"strnum": "^1.0.5"
|
|
93
70
|
}
|
|
94
71
|
}
|