4.5.0 • Published 3 months ago

fast-xml-parser v4.5.0

Weekly downloads
670,327
License
MIT
Repository
github
Last release
3 months ago

fast-xml-parser

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.


I had recently published a book, The Power Glasses. Please have a look. Your feedback would be helpful. You can mail me for a free copy.

Sponsor this project

fxp_sponsors

Users

more

The list of users are mostly published by Github or communicated directly. Feel free to contact if you find any information wrong.


Main Features

  • Validate XML data syntactically
  • Parse XML to JS Object
  • Build XML from JS Object
  • Compatible to node js packages, in browser, and in CLI (click 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>

Bundle size

Bundle NameSize
fxbuilder.min.js6.5K
fxparser.min.js20K
fxp.min.js26K
fxvalidator.min.js5.7K

Documents

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.

Performance

negative means error

XML Parser

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

XML Builder

Usage Trend

Usage Trend of fast-xml-parser

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@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-coretesting-ci-ortsa-rssebbplottervideo-templatestylesettergenerator-jhipster-wda@everything-registry/sub-chunk-1649jawwy-sdkjawwy_gamification_releasesitemap-generator-webpack-plugin@bioroxx/kmljsyourdata-sdkreact-native-sphereuisphereui
4.5.0

3 months ago

4.4.1

4 months ago

4.4.0

6 months ago

4.3.6

8 months ago

4.3.5

9 months ago

4.3.4

10 months ago

4.3.3

11 months ago

4.3.2

1 year ago

4.3.1

1 year ago

4.3.0

1 year ago

4.2.5

1 year ago

4.2.7

1 year ago

4.2.6

1 year ago

4.2.3

1 year ago

4.2.4

1 year ago

4.2.2

2 years ago

4.2.1

2 years ago

4.2.0

2 years ago

4.1.4

2 years ago

4.1.3

2 years ago

4.1.2

2 years ago

4.0.15

2 years ago

4.0.14

2 years ago

4.1.0

2 years ago

4.1.1

2 years ago

4.0.12

2 years ago

4.0.11

2 years ago

4.0.13

2 years ago

4.0.10

2 years ago

4.0.9

2 years ago

4.0.8

2 years ago

4.0.5

3 years ago

4.0.4

3 years ago

4.0.7

3 years ago

4.0.6

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.3

3 years ago

4.0.2

3 years ago

4.0.0-beta.8

3 years ago

4.0.0-beta.7

3 years ago

4.0.0-beta.6

3 years ago

4.0.0-beta.5

3 years ago

4.0.0-beta.4

3 years ago

4.0.0-beta.3

3 years ago

4.0.0-beta.2

3 years ago

4.0.0-beta.0

3 years ago

3.21.1

3 years ago

3.21.0

3 years ago

3.20.3

3 years ago

3.20.0

3 years ago

3.19.0

4 years ago

3.18.0

4 years ago

3.17.6

4 years ago

3.17.5

4 years ago

3.17.4

4 years ago

3.17.3

4 years ago

3.17.2

5 years ago

3.17.1

5 years ago

3.17.0

5 years ago

3.16.0

5 years ago

3.15.1

5 years ago

3.15.0

5 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

6 years ago

3.12.14

6 years ago

3.12.13

6 years ago

3.12.12

6 years ago

3.12.11

6 years ago

3.12.10

6 years ago

3.12.9

6 years ago

3.12.8

6 years ago

3.12.7

6 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

7 years ago

3.10.0

7 years ago

3.9.11

7 years ago

3.9.10

7 years ago

3.3.9

7 years ago

3.3.8

7 years ago

3.3.7

7 years ago

3.3.6

7 years ago

3.3.5

7 years ago

3.3.4

7 years ago

3.3.3

7 years ago

3.3.2

7 years ago

3.3.1

7 years ago

3.3.0

7 years ago

3.2.4

7 years ago

3.2.3

7 years ago

3.2.2

7 years ago

3.2.1

7 years ago

3.2.0

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.9.4

7 years ago

2.9.3

7 years ago

2.9.2

7 years ago

2.9.1

7 years ago

2.9.0

7 years ago

2.8.3

7 years ago

2.8.2

7 years ago

2.8.1

7 years ago

2.8.0

7 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

8 years ago

2.3.1

8 years ago

2.3.0

8 years ago

2.2.1

8 years ago

2.2.0

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago