Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

fast-xml-parser 4.3.4

Validate XML, Parse XML, Build XML without C/C++ based libraries
Package summary
Share
0
issues
0
licenses
Package created
28 Jan 2017
Version published
30 Jan 2024
Maintainers
1
Total deps
0
Direct deps
0
License
MIT
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does fast-xml-parser do?

Fast-XML-Parser serves as a swift, JavaScript-based utility enabling developers to validate, parse, and build XML data. It carries out these operations without requiring any C/C++ based libraries. Boasting a faster performance than any other pure JavaScript implementation, it can handle large files (which have been tested up to 100mb in size), supporting controlled parsing using various options. It supports XML Entities, HTML entities, and DOCTYPE entities and can accommodate unpaired tags, stop nodes, among other elements. Importantly, Fast-XML-Parser can almost restore the original XML from a JSON object while preserving the order of tags in the JS object.

How do you use fast-xml-parser?

Using Fast-XML-Parser involves installing it and integrating it into your codebase. For package dependency, you can use the command $ npm install fast-xml-parser or $ yarn add fast-xml-parser. For system command utility, employ $ npm install fast-xml-parser -g.

Example code for 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);

For HTML page usage, you would include the script from a CDN and utilize the parser as follows:

<script src="path/to/fxp.min.js"></script>
:
<script>
  const parser = new fxparser.XMLParser();
  parser.parse(xmlContent);
</script>

As a CLI command, you can use fxparser some.xml.

Where are the fast-xml-parser docs?

The documentation for Fast-XML-Parser resides directly in the GitHub repository. You can find detailed instructions for using the library in the docs folder, which contains separate documentations for versions 3 and 4 of the library; v3 documents and v4 documents.