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

XMLパーサーライブラリ

XMLパーサーライブラリは、XMLデータをJavaScriptオブジェクトに変換したり、その逆を行ったりするためのツールです。これらのライブラリは、XMLデータを操作する際の効率を高め、開発者がデータを簡単に扱えるようにします。これにより、XMLデータの読み込み、解析、生成が容易になります。

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

3 年

GitHub Starsランキング

統計詳細

パッケージ
ダウンロード数
Stars
サイズ
Issues
公開日時
ライセンス
fast-xml-parser67,733,3553,052800 kB605時間前MIT
xml2js32,350,3344,9733.44 MB2473年前MIT
xml-js6,757,5231,339-1267年前MIT

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

パフォーマンス

  • fast-xml-parser:

    fast-xml-parserは、非常に高速なXML解析を提供します。特に大規模なXMLデータを扱う際に、そのパフォーマンスの優位性が際立ちます。

  • xml2js:

    xml2jsは、パフォーマンスは中程度ですが、柔軟性が高く、複雑なXMLデータを扱う際に役立ちます。

  • xml-js:

    xml-jsは、パフォーマンスは良好ですが、fast-xml-parserほどの速度はありません。シンプルなXMLデータの解析には適していますが、大規模データには向いていません。

APIの使いやすさ

  • fast-xml-parser:

    fast-xml-parserは、直感的なAPIを提供しており、簡単に使用できます。設定も少なく、すぐに始められます。

  • xml2js:

    xml2jsは、APIがやや複雑ですが、豊富なオプションがあり、詳細な設定が可能です。

  • xml-js:

    xml-jsは、非常にシンプルで使いやすいAPIを持っており、初心者でも扱いやすいです。

エラーハンドリング

  • fast-xml-parser:

    fast-xml-parserは、エラーハンドリングが優れており、解析中に発生したエラーを簡単にキャッチできます。

  • xml2js:

    xml2jsは、エラーハンドリングが強力で、解析中のエラーを詳細に報告します。

  • xml-js:

    xml-jsは、基本的なエラーハンドリング機能を提供しますが、詳細なエラー情報は提供されません。

XMLの変換機能

  • fast-xml-parser:

    fast-xml-parserは、XMLからJavaScriptオブジェクトへの変換が非常に高速です。

  • xml2js:

    xml2jsは、XMLからJavaScriptオブジェクトへの変換において、非常に柔軟なオプションを提供します。

  • xml-js:

    xml-jsは、XMLとJavaScriptオブジェクト間の変換がシンプルで、使いやすいです。

ドキュメントとサポート

  • fast-xml-parser:

    fast-xml-parserは、豊富なドキュメントがあり、サポートも充実しています。

  • xml2js:

    xml2jsは、広範なドキュメントがあり、コミュニティサポートも活発です。

  • xml-js:

    xml-jsは、基本的なドキュメントが提供されていますが、詳細な情報は不足しています。

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

  • fast-xml-parser:

    高速なXML解析が必要で、パフォーマンスを重視する場合はfast-xml-parserを選択してください。このライブラリは、軽量でありながら非常に高速な解析を提供します。

  • xml2js:

    柔軟性が必要で、複雑なXML構造を扱う場合はxml2jsを選択してください。このライブラリは、豊富なオプションを提供し、カスタマイズ可能な解析をサポートします。

  • xml-js:

    XMLとJavaScriptオブジェクトの相互変換を簡単に行いたい場合はxml-jsを選択してください。このライブラリは、シンプルなAPIを提供し、使いやすさが特徴です。

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