4.3.6 • Published 1 month ago

fast-xml-parser v4.3.6

Weekly downloads
670,327
License
MIT
Repository
github
Last release
1 month ago

fast-xml-parser

Known Vulnerabilities NPM quality Coverage Status NPM total downloads

Validate XML, Parse XML to JS Object, or Build XML from JS Object without C/C++ based libraries and no callback.

XML Parser v5 is added for experimental use https://solothought.com

Sponsor this project 👉

Current Sponsors

Check the complete list at ThankYouBackers for our sponsors and supporters.

Through Github

Through OpenCollective

Users

Check the bigger list

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.

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

Main Features

  • Validate XML data syntactically
  • Parse XML to JS Object
  • Build XML from JS Object
  • Works with node packages, in browser, and in CLI (press try me button above for demo)
  • Faster than any other pure JS implementation.
  • It can handle big files (tested up to 100mb).
  • Controlled parsing using various options
  • XML Entities, HTML entities, and DOCTYPE entites are supported.
  • unpaired tags (Eg <br> in HTML), stop nodes (Eg <script> in HTML) are supported.
  • You can restore almost same XML from JSON
  • Supports comments
  • It can preserve Order of tags in JS object
  • You can control if a single tag should be parsed into array.
  • Supports parsing of PI (Processing Instruction) tags with XML declaration tags
  • And many more other features.

v5

I developed v5 in Apr 2023. And I didn't get the chance to complete all the features. I've ensured that new features don't impact performance. With v5, you have more control on parsing output. Check docs for syntax help and basic understanding.

Please leave a comment in discussion forum for your suggestions and if you really need v5.

How to use

To use as package dependency $ npm install fast-xml-parser or $ yarn add fast-xml-parser

To use as system command $ npm install fast-xml-parser -g

To use it on a webpage include it from a CDN

Example

As CLI command

$ fxparser some.xml

In a node js project

const { XMLParser, XMLBuilder, XMLValidator} = require("fast-xml-parser");

const parser = new XMLParser();
let jObj = parser.parse(XMLdata);

const builder = new XMLBuilder();
const xmlContent = builder.build(jObj);

In a HTML page

<script src="path/to/fxp.min.js"></script>
:
<script>
  const parser = new fxparser.XMLParser();
  parser.parse(xmlContent);
</script>

Check lib folder for different browser bundles

Bundle NameSize
fxbuilder.min.js5.2K
fxparser.js50K
fxparser.min.js17K
fxp.min.js22K
fxvalidator.min.js5.7K

Documents

v3

v4 1. GettingStarted.md 2. XML Parser 3. XML Builder 4. XML Validator 5. Entities 6. HTML Document Parsing 7. PI Tag processing

Performance

XML Parser

npm.io

  • Y-axis: requests per second
  • X-axis: File size

Large files npm.io

  • Y-axis: requests per second
  • X-axis: File size

XML Builder

npm.io

  • Y-axis: requests per second

negative means error

npm.io

Supporters

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! 🙏 [Become a backer]

License

  • MIT License

Donate $5

is-svg@google-cloud/storagevue-fast-xml-parser@build-tools-for-vmware-aria/codifyfork-appcenter-cli@beskar-labs/medium-feedaggregation-ssmlcfw-r2-proxy@salto-io/salesforce-adapter@salto-io/netsuite-adapter@sap-cloud-sdk/generator@kazion/dpo-node-sdkeasy-select-rn@weirwoodai/parse-xbrlfaa-notam-sdk-testanghamimediaenginebroadsoftocihpservercatastro-clientwebdriverio-typescript-dockerworkspace-webdriveriornjs_v1schema-ohhc-stuffilitofa-beautifierfa-nodejsfa-nodejs-beautifierfoxartuni-app-hybrid-packalpine-code-sdk-jssommario-app@liongard/roar-sdkfeed-simulcast@iharob/graphql-mesh-odatarentsure-crm-data-processortransmetrix-paymentsniconico-apis@rappopo/cuk-util@tomfrenken/generatormta-node@the_anomaly/web-theoryboardgamegeekjsclientfaa-notam-sdkhomebridge-infinitude-schedulesradiko-apipostal-middlewareiobroker.onkyo2mtabt-plugin-metawrm-troubleshooting-poc@isygis/veiprofilgenerator-conacyt@alpine-code/alpine-code-sdk-jsscreenplay-parsermyfrontdesk-testmta-build-toolrun-statsards-clientvsdxjssid-npm-test3sid-npmtest-1sid-npmtest-2sid-test-create-npmpagsg-api@eonenergy/eon-sfdx@elijahjpassmore/qwc2anuvadak@oai-pmh-js/oai-xml-parsergatsby-source-pollenvarsel@rtlib/qa-cliopenpanos-server@picker-cc/wechat-pluginapogistrapi-wizualizacje-templateodata-xtractunblock-block-save-variables@bugsounet/nat-apihappy-wheelshappywheels.jshexa-node-common@infinitebrahmanuniverse/nolb-fast-@ndml/version-api@ethang/util-typescriptqueryfinitemodels@1password/web-apinode_wehcat_openlandonschropp.comnav-invoicefa-basefa-frameworkgetbankapi-bnmluminos-ui-core@wavemaker/app-rn-runtimetesting-ci-ortsa-rsshomebridge-denon-tvhomebridge-enphase-envoyebbplottervideo-templatestylesettergenerator-jhipster-wda@everything-registry/sub-chunk-1649jawwy-sdk
4.3.6

1 month ago

4.3.5

2 months ago

4.3.4

3 months ago

4.3.3

4 months ago

4.3.2

7 months ago

4.3.1

7 months ago

4.3.0

7 months ago

4.2.5

10 months ago

4.2.7

9 months ago

4.2.6

9 months ago

4.2.3

11 months ago

4.2.4

11 months ago

4.2.2

1 year ago

4.2.1

1 year ago

4.2.0

1 year ago

4.1.4

1 year ago

4.1.3

1 year ago

4.1.2

1 year ago

4.0.15

1 year ago

4.0.14

1 year ago

4.1.0

1 year ago

4.1.1

1 year ago

4.0.12

1 year ago

4.0.11

2 years ago

4.0.13

1 year ago

4.0.10

2 years ago

4.0.9

2 years ago

4.0.8

2 years ago

4.0.5

2 years ago

4.0.4

2 years ago

4.0.7

2 years ago

4.0.6

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

4.0.0-beta.8

2 years ago

4.0.0-beta.7

2 years ago

4.0.0-beta.6

2 years ago

4.0.0-beta.5

2 years ago

4.0.0-beta.4

2 years ago

4.0.0-beta.3

2 years ago

4.0.0-beta.2

2 years ago

4.0.0-beta.0

2 years ago

3.21.1

2 years ago

3.21.0

3 years ago

3.20.3

3 years ago

3.20.0

3 years ago

3.19.0

3 years ago

3.18.0

3 years ago

3.17.6

3 years ago

3.17.5

3 years ago

3.17.4

4 years ago

3.17.3

4 years ago

3.17.2

4 years ago

3.17.1

4 years ago

3.17.0

4 years ago

3.16.0

4 years ago

3.15.1

4 years ago

3.15.0

4 years ago

3.14.0

5 years ago

3.13.0

5 years ago

3.12.21

5 years ago

3.12.20

5 years ago

3.12.19

5 years ago

3.12.18

5 years ago

3.12.17

5 years ago

3.12.16

5 years ago

3.12.14

5 years ago

3.12.13

5 years ago

3.12.12

5 years ago

3.12.11

5 years ago

3.12.10

5 years ago

3.12.9

5 years ago

3.12.8

5 years ago

3.12.7

5 years ago

3.12.5

6 years ago

3.12.4

6 years ago

3.12.3

6 years ago

3.12.2

6 years ago

3.12.0

6 years ago

3.11.2

6 years ago

3.11.1

6 years ago

3.11.0

6 years ago

3.10.0

6 years ago

3.9.11

6 years ago

3.9.10

6 years ago

3.3.9

6 years ago

3.3.8

6 years ago

3.3.7

6 years ago

3.3.6

6 years ago

3.3.5

6 years ago

3.3.4

6 years ago

3.3.3

6 years ago

3.3.2

6 years ago

3.3.1

6 years ago

3.3.0

6 years ago

3.2.4

6 years ago

3.2.3

6 years ago

3.2.2

6 years ago

3.2.1

6 years ago

3.2.0

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.9.4

6 years ago

2.9.3

6 years ago

2.9.2

6 years ago

2.9.1

6 years ago

2.9.0

6 years ago

2.8.3

6 years ago

2.8.2

6 years ago

2.8.1

6 years ago

2.8.0

6 years ago

2.7.4

7 years ago

2.7.3

7 years ago

2.7.2

7 years ago

2.7.1

7 years ago

2.7.0

7 years ago

2.6.0

7 years ago

2.5.1

7 years ago

2.5.0

7 years ago

2.4.4

7 years ago

2.4.3

7 years ago

2.4.1

7 years ago

2.3.1

7 years ago

2.3.0

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago