fast-xml-parser

Validate XML, Parse XML, Build XML without C/C++ based libraries

fast-xml-parser downloads fast-xml-parser version fast-xml-parser license

fast-xml-parserSimilar Packages:

Npm Package Weekly Downloads Trend

3 Years
🌟 Show real-time usage chart on fast-xml-parser's README.md, just copy the code below.
## Usage Trend
[![Usage Trend of fast-xml-parser](https://npm-compare.com/img/npm-trend/THREE_YEARS/fast-xml-parser.png)](https://npm-compare.com/fast-xml-parser#timeRange=THREE_YEARS)

Cumulative GitHub Star Trend

🌟 Show GitHub stars trend chart on fast-xml-parser's README.md, just copy the code below.
## GitHub Stars Trend
[![GitHub Stars Trend of fast-xml-parser](https://npm-compare.com/img/github-trend/fast-xml-parser.png)](https://npm-compare.com/fast-xml-parser)

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
fast-xml-parser03,081987 kB342 days agoMIT

README for fast-xml-parser

fast-xml-parser

NPM total downloads

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

FXP logo
  • Validate XML data syntactically. Use detailed-xml-validator to verify business rules.
  • Parse XML to JS Objects and vice versa
  • Common JS, ESM, and browser compatible
  • Faster than any other pure JS implementation.

It can handle big files (tested up to 100mb). XML Entities, HTML entities, and DOCTYPE entites are supported. Unpaired tags (Eg <br> in HTML), stop nodes (Eg <script> in HTML) are supported. It can also preserve Order of tags in JS object


Your Support, Our Motivation

Please join Discord community for pre release announcements and discussions. This will prevent us to release breaking changes.

Financial Support

Sponsor this project




This is a donation. No goods or services are expected in return. Any requests for refunds for those purposes will be rejected.

fxp_sponsors

This image update once in 6 months mostly

Users

more

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


More about this library

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

v3v4 and v5v6
documents
  1. Getting Started
  2. XML Parser
  3. XML Builder
  4. XML Validator
  5. Entities
  6. HTML Document Parsing
  7. PI Tag processing
  8. Path Expression
  1. Getting Started
  2. Features
  3. Options
  4. Output Builders
  5. Value Parsers

note:

  • Version 6 is released with version 4 for experimental use. Based on its demand, it'll be developed and the features can be different in final release.
  • Version 5 has the same functionalities as version 4.

Performance

negative means error

XML Parser

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

XML Builder

* Y-axis: requests per second

Usage Trend

Usage Trend of fast-xml-parser

NPM Usage Trend of fast-xml-parser

Supporters

Contributors

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

Backers from Open collective

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

License

  • MIT License

Donate $5