fast-xml-parser vs xml-js vs xml2js vs xmldom
XMLパーサーライブラリ
fast-xml-parserxml-jsxml2jsxmldom類似パッケージ:

XMLパーサーライブラリ

XMLパーサーライブラリは、XMLデータをJavaScriptオブジェクトに変換したり、逆にJavaScriptオブジェクトをXML形式に変換したりするためのツールです。これらのライブラリは、XMLデータの操作を簡素化し、開発者がデータを効率的に処理できるようにします。特に、WebアプリケーションやAPIとの連携において、XMLフォーマットのデータを扱う際に役立ちます。

npmのダウンロードトレンド

3 年

GitHub Starsランキング

統計詳細

パッケージ
ダウンロード数
Stars
サイズ
Issues
公開日時
ライセンス
fast-xml-parser71,061,5293,062856 kB666日前MIT
xml-js8,076,0291,340-1257年前MIT
xml2js04,9713.44 MB2493年前MIT
xmldom0446-515年前MIT

機能比較: fast-xml-parser vs xml-js vs xml2js vs xmldom

パフォーマンス

  • fast-xml-parser:

    非常に高速なXMLパースを提供し、大量のデータを短時間で処理できます。特に、パフォーマンスが重要なアプリケーションに最適です。

  • xml-js:

    パフォーマンスは良好ですが、他のライブラリに比べるとやや遅い場合があります。XMLとJSONの変換に特化しているため、特定の用途に適しています。

  • xml2js:

    パフォーマンスは標準的で、特に複雑なXMLを扱う場合に柔軟性を持っています。大規模なXMLデータを扱う場合でも安定しています。

  • xmldom:

    DOM APIを使用しているため、パフォーマンスは良好ですが、他のライブラリに比べるとやや遅い場合があります。

選び方: fast-xml-parser vs xml-js vs xml2js vs xmldom

  • fast-xml-parser:

    高速なパフォーマンスが求められる場合や、シンプルなXMLの解析が必要な場合に選択してください。特に、大量のデータを扱う際にその速度が際立ちます。

  • xml-js:

    XMLとJSONの相互変換が必要な場合に選択してください。特に、XMLをJSON形式に変換したい場合に便利です。

  • xml2js:

    柔軟性と拡張性を重視する場合に選択してください。特に、複雑なXML構造を扱う場合に適しています。

  • xmldom:

    DOM APIに基づく操作が必要な場合に選択してください。特に、XML文書をDOMツリーとして扱いたい場合に便利です。

fast-xml-parser のREADME

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

Try out our New Thoughts

  • WishIn - You need it if negative thoughts take over all the time
  • Flowgger: 90% less logs size and 90% less debugging time
    Flowgger Logging Framework
  • Text2Chart: interactive flow chart out of simple text.

Financial Support

Sponsor this project

donate button


fxp_sponsors

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

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