fast-xml-parser vs xmlbuilder vs xml2js vs xmldom vs libxmljs2 vs libxmljs
XMLパーサーライブラリ
fast-xml-parserxmlbuilderxml2jsxmldomlibxmljs2libxmljs類似パッケージ:

XMLパーサーライブラリ

XMLパーサーライブラリは、XMLデータを解析し、JavaScriptオブジェクトに変換するためのツールです。これらのライブラリは、XMLの読み込み、操作、生成を簡素化し、開発者がXMLデータを効率的に扱えるようにします。これにより、Webアプリケーションやサービスでのデータ交換が容易になります。

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

3 年

GitHub Starsランキング

統計詳細

パッケージ
ダウンロード数
Stars
サイズ
Issues
公開日時
ライセンス
fast-xml-parser63,588,0643,036607 kB661日前MIT
xmlbuilder45,043,311926-76年前MIT
xml2js30,080,8024,9713.44 MB2483年前MIT
xmldom1,726,243444-505年前MIT
libxmljs2304,56487.22 MB299ヶ月前MIT
libxmljs77,1331,06217.7 MB692年前MIT

機能比較: fast-xml-parser vs xmlbuilder vs xml2js vs xmldom vs libxmljs2 vs libxmljs

パフォーマンス

  • fast-xml-parser:

    非常に高速なXML解析を提供し、大規模なXMLデータを効率的に処理できます。

  • xmlbuilder:

    XMLを動的に生成する際に、効率的なパフォーマンスを発揮します。

  • xml2js:

    シンプルなXMLをJavaScriptオブジェクトに変換する際に、比較的速いパフォーマンスを提供します。

  • xmldom:

    DOM APIを使用してXMLを操作するため、パフォーマンスはDOM操作の効率に依存します。

  • libxmljs2:

    libxmljsの改良版で、パフォーマンスが向上しており、特に大規模なXMLファイルの処理に適しています。

  • libxmljs:

    C言語で書かれたlibxml2に基づいており、高速で信頼性の高いパフォーマンスを提供します。

機能

  • fast-xml-parser:

    シンプルなAPIを提供し、XMLをJavaScriptオブジェクトに変換する機能が主な特徴です。

  • xmlbuilder:

    XMLをプログラム的に生成するための強力な機能を提供します。

  • xml2js:

    XMLをJavaScriptオブジェクトに変換するシンプルな機能を提供します。

  • xmldom:

    DOM APIを使用してXMLを操作するため、既存のDOM操作ライブラリとの互換性があります。

  • libxmljs2:

    libxmljsの機能を拡張し、最新のXML機能をサポートします。

  • libxmljs:

    高度なXML機能(スキーマ検証、XPathサポートなど)を提供し、複雑なXML操作に適しています。

学習曲線

  • fast-xml-parser:

    シンプルなAPIのため、学習曲線は比較的緩やかです。

  • xmlbuilder:

    XML生成のためのAPIが直感的で、学習曲線は比較的緩やかです。

  • xml2js:

    非常にシンプルなAPIのため、学習曲線は緩やかで、すぐに使い始めることができます。

  • xmldom:

    DOM APIに慣れている開発者には学習曲線が低いですが、初めての人には少し難しいかもしれません。

  • libxmljs2:

    libxmljsと同様の学習曲線ですが、より多くの機能が追加されています。

  • libxmljs:

    C言語に基づくため、少し学習曲線が急ですが、強力な機能を提供します。

拡張性

  • fast-xml-parser:

    シンプルな設計のため、拡張性は限られていますが、必要に応じてカスタマイズ可能です。

  • xmlbuilder:

    動的なXML生成に特化しており、拡張性が高いです。

  • xml2js:

    シンプルな設計で、拡張性は限られていますが、基本的な機能はカスタマイズ可能です。

  • xmldom:

    DOM操作に基づくため、他のライブラリとの統合が容易で、拡張性があります。

  • libxmljs2:

    libxmljsの拡張性を引き継ぎつつ、さらに多くの機能を追加しています。

  • libxmljs:

    高度な機能を持ち、拡張性が高いです。特にプラグインやカスタム機能を追加しやすいです。

使用シナリオ

  • fast-xml-parser:

    高速なXML解析が必要なリアルタイムアプリケーションに最適です。

  • xmlbuilder:

    動的にXMLを生成する必要があるアプリケーションに最適です。

  • xml2js:

    シンプルなXMLデータを扱う小規模なアプリケーションに適しています。

  • xmldom:

    既存のDOM操作ライブラリと統合する必要があるプロジェクトに適しています。

  • libxmljs2:

    最新のXML機能を必要とするプロジェクトに最適です。

  • libxmljs:

    複雑なXMLデータを扱うエンタープライズアプリケーションに適しています。

選び方: fast-xml-parser vs xmlbuilder vs xml2js vs xmldom vs libxmljs2 vs libxmljs

  • fast-xml-parser:

    高速な解析が必要で、シンプルなAPIを求める場合はfast-xml-parserを選択してください。特にパフォーマンスが重視されるプロジェクトに適しています。

  • xmlbuilder:

    XMLをプログラム的に生成する必要がある場合はxmlbuilderを選択してください。特に動的にXMLを作成する場合に便利です。

  • xml2js:

    シンプルなXMLをJavaScriptオブジェクトに変換する必要がある場合はxml2jsを選択してください。特に簡単なデータ変換が求められる場合に適しています。

  • xmldom:

    DOM APIを使用してXMLを操作したい場合はxmldomを選択してください。特に既存のDOM操作ライブラリとの統合が必要な場合に適しています。

  • libxmljs2:

    libxmljsの後継で、より良いパフォーマンスと機能を提供します。最新の機能が必要な場合はlibxmljs2を選択してください。

  • libxmljs:

    C言語で書かれたlibxml2に基づいており、高度なXML機能が必要な場合はlibxmljsを選択してください。特にXMLスキーマ検証やXPathサポートが必要な場合に最適です。

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
  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