{"_id":"cos-fast-xml-parser","name":"cos-fast-xml-parser","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"cos-fast-xml-parser","version":"1.0.0","description":"Fork of fast-xml-parser@4.5.6 for COS Node.js SDK, with ES2020 syntax replaced for Node 9+ compatibility.","main":"./src/fxp.js","scripts":{"test":"c8 --reporter=lcov --reporter=text jasmine spec/*spec.js","test-types":"tsc --noEmit spec/typings/typings-test.ts","unit":"jasmine","perf":"node ./benchmark/perfTest3.js","lint":"eslint src/*.js spec/*.js","bundle":"webpack --config webpack-prod.config.js","prettier":"prettier --write src/**/*.js","publish-please":"publish-please","checkReadiness":"publish-please --dry-run"},"bin":{"fxparser":"src/cli/cli.js"},"engines":{"node":">= 9"},"keywords":["fast","xml","json","parser","xml2js","x2js","xml2json","js","cli","validator","validate","transformer","assert","js2xml","json2xml","html"],"author":{"name":"Amit Gupta","url":"https://solothought.com"},"license":"MIT","devDependencies":{"@babel/core":"^7.13.10","@babel/plugin-transform-runtime":"^7.13.10","@babel/preset-env":"^7.13.10","@babel/register":"^7.13.8","@types/node":"20","babel-loader":"^8.2.2","c8":"^10.1.3","eslint":"^8.3.0","he":"^1.2.0","jasmine":"^3.6.4","prettier":"^1.19.1","publish-please":"^5.5.2","typescript":"5","webpack":"^5.64.4","webpack-cli":"^4.9.1"},"typings":"src/fxp.d.ts","funding":[{"type":"github","url":"https://github.com/sponsors/NaturalIntelligence"}],"dependencies":{"strnum":"^1.0.5"},"_id":"cos-fast-xml-parser@1.0.0","gitHead":"f3b260a56757d6eccec9e38d9e3dc348fb4666bf","_nodeVersion":"20.18.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-kOPJb1cuj+gc5E8jN5ekZn4rgQHaxYTLcQT+jmbHtlTNcNjv7wnOBEYH2uRA0pG3h8giot4z9h4WFLDuXATZwg==","shasum":"91a4f57f439b9abfd4f569cd345e205273923c9d","tarball":"https://registry.npmjs.org/cos-fast-xml-parser/-/cos-fast-xml-parser-1.0.0.tgz","fileCount":46,"unpackedSize":201726,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCv15WwzbyJCBVUTCoBYjpJDBNVOICPOmBYDkB2WaWh8AIhAPl9ZzXHVssT10WW/8UkxMaAQVasVqn/cCqnhxQjOVhv"}]},"_npmUser":{"name":"annexwu","email":"annexwu@tencent.com"},"directories":{},"maintainers":[{"name":"annexwu","email":"annexwu@tencent.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cos-fast-xml-parser_1.0.0_1779433366647_0.2175643248532253"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-22T07:02:46.596Z","1.0.0":"2026-05-22T07:02:46.902Z","modified":"2026-05-22T07:02:47.074Z"},"maintainers":[{"name":"annexwu","email":"annexwu@tencent.com"}],"description":"Fork of fast-xml-parser@4.5.6 for COS Node.js SDK, with ES2020 syntax replaced for Node 9+ compatibility.","keywords":["fast","xml","json","parser","xml2js","x2js","xml2json","js","cli","validator","validate","transformer","assert","js2xml","json2xml","html"],"author":{"name":"Amit Gupta","url":"https://solothought.com"},"license":"MIT","readme":"# [fast-xml-parser](https://www.npmjs.com/package/fast-xml-parser)\r\n[![NPM quality][quality-image]][quality-url]\r\n[![Coverage Status](https://coveralls.io/repos/github/NaturalIntelligence/fast-xml-parser/badge.svg?branch=master)](https://coveralls.io/github/NaturalIntelligence/fast-xml-parser?branch=master)\r\n[<img src=\"https://img.shields.io/badge/Try-me-blue.svg?colorA=FFA500&colorB=0000FF\" alt=\"Try me\"/>](https://naturalintelligence.github.io/fast-xml-parser/)\r\n[![NPM total downloads](https://img.shields.io/npm/dt/fast-xml-parser.svg)](https://npm.im/fast-xml-parser)\r\n\r\n\r\nValidate XML, Parse XML to JS Object, or Build XML from JS Object without C/C++ based libraries and no callback.\r\n\r\n---\r\n\r\n<small>Checkout our new library [Text2Chart](https://solothought.com/text2chart/flow) that constructs flow chart out of simple text. Very helpful in creating or alayzing an algorithm, and documentation purpose</small>\r\n<br>\r\n\r\nSponsor this project\r\n\r\n<a href=\"https://github.com/sponsors/NaturalIntelligence\"> \r\n  <img src=\"https://raw.githubusercontent.com/NaturalIntelligence/ThankYouBackers/main/github_sponsor.png\" width=\"180\" />\r\n</a>\r\n<a href=\"https://opencollective.com/fast-xml-parser/donate\" target=\"_blank\">\r\n  <img src=\"https://opencollective.com/fast-xml-parser/donate/button@2x.png?color=blue\" width=180 />\r\n</a>\r\n<a href=\"https://paypal.me/naturalintelligence\"> <img src=\"static/img/support_paypal.svg\" alt=\"donate button\" width=\"180\"/></a>\r\n<br>\r\n<br>\r\n<br>\r\n\r\n<!--\r\n### Current Sponsors\r\n\r\nCheck the complete list at [ThankYouBackers](https://github.com/NaturalIntelligence/ThankYouBackers) for our sponsors and supporters.\r\n\r\nThrough Github\r\n\r\n<a href=\"https://github.com/skunkteam\" target=\"_blank\"><img src=\"https://avatars.githubusercontent.com/u/46373671?s=60\" width=\"60px\"></a>\r\n<a href=\"https://github.com/getsentry\" target=\"_blank\"><img src=\"https://avatars.githubusercontent.com/u/1396951?s=60\" width=\"60px\"></a>\r\n\r\nThrough OpenCollective\r\n\r\n<a href=\"https://opencollective.com/fast-xml-parser/sponsor/0/website\" target=\"_blank\"><img src=\"https://opencollective.com/fast-xml-parser/sponsor/0/avatar.svg\"></a>\r\n<a href=\"https://opencollective.com/fast-xml-parser/sponsor/1/website\" target=\"_blank\"><img src=\"https://opencollective.com/fast-xml-parser/sponsor/1/avatar.svg\"></a>\r\n<a href=\"https://opencollective.com/fast-xml-parser/sponsor/2/website\" target=\"_blank\"><img src=\"https://opencollective.com/fast-xml-parser/sponsor/2/avatar.svg\"></a>\r\n<a href=\"https://opencollective.com/fast-xml-parser/sponsor/3/website\" target=\"_blank\"><img src=\"https://opencollective.com/fast-xml-parser/sponsor/3/avatar.svg\"></a>\r\n<a href=\"https://opencollective.com/fast-xml-parser/sponsor/4/website\" target=\"_blank\"><img src=\"https://opencollective.com/fast-xml-parser/sponsor/4/avatar.svg\"></a>\r\n<a href=\"https://opencollective.com/fast-xml-parser/sponsor/5/website\" target=\"_blank\"><img src=\"https://opencollective.com/fast-xml-parser/sponsor/5/avatar.svg\"></a>\r\n<a href=\"https://opencollective.com/fast-xml-parser/sponsor/6/website\" target=\"_blank\"><img src=\"https://opencollective.com/fast-xml-parser/sponsor/6/avatar.svg\"></a>\r\n<a href=\"https://opencollective.com/fast-xml-parser/sponsor/7/website\" target=\"_blank\"><img src=\"https://opencollective.com/fast-xml-parser/sponsor/7/avatar.svg\"></a>\r\n<a href=\"https://opencollective.com/fast-xml-parser/sponsor/8/website\" target=\"_blank\"><img src=\"https://opencollective.com/fast-xml-parser/sponsor/8/avatar.svg\"></a>\r\n<a href=\"https://opencollective.com/fast-xml-parser/sponsor/9/website\" target=\"_blank\"><img src=\"https://opencollective.com/fast-xml-parser/sponsor/9/avatar.svg\"></a>\r\n-->\r\n\r\n![fxp_sponsors](https://raw.githubusercontent.com/NaturalIntelligence/ThankYouBackers/main/assets/NI_sponsors.jpg)\r\n- <a href=\"https://github.com/cocopon\" target=\"_blank\">Hiroki Kokubun</a>\r\n\r\n> This is a donation. No goods or services are expected in return. Any requests for refunds for those purposes will be rejected.\r\n## Users\r\n\r\n<a href=\"https://github.com/renovatebot/renovate\" title=\"renovate\" ><img src=\"https://avatars1.githubusercontent.com/u/38656520\" width=\"60px\" ></a>\r\n<a href=\"https://vmware.com/\" title=\"vmware\" > <img src=\"https://avatars0.githubusercontent.com/u/473334\" width=\"60px\" ></a>\r\n<a href=\"https://opensource.microsoft.com/\" title=\"microsoft\" > <img src=\"https://avatars0.githubusercontent.com/u/6154722\" width=\"60px\" ></a>\r\n<a href=\"http://ibm.github.io/\" title=\"IBM\" > <img src=\"https://avatars2.githubusercontent.com/u/1459110\" width=\"60px\" ></a>\r\n<a href=\"http://www.smartbear.com\" title=\"SmartBear Software\" > <img src=\"https://avatars2.githubusercontent.com/u/1644671\" width=\"60px\" ></a>\r\n<a href=\"http://nasa.github.io/\" title=\"NASA\" > <img src=\"https://avatars0.githubusercontent.com/u/848102\" width=\"60px\" ></a>\r\n<a href=\"https://github.com/prettier\" title=\"Prettier\" > <img src=\"https://avatars0.githubusercontent.com/u/25822731\" width=\"60px\" ></a>\r\n<a href=\"http://brain.js.org/\" title=\"brain.js\" > <img src=\"https://avatars2.githubusercontent.com/u/23732838\" width=\"60px\" ></a>\r\n<a href=\"https://github.com/aws\" title=\"AWS SDK\" > <img src=\"https://avatars.githubusercontent.com/u/2232217\" width=\"60px\" ></a>\r\n<a href=\"http://www.fda.gov/\" title=\"Food and Drug Administration \" > <img src=\"https://avatars2.githubusercontent.com/u/6471964\" width=\"60px\" ></a>\r\n<a href=\"http://www.magento.com/\" title=\"Magento\" > <img src=\"https://avatars2.githubusercontent.com/u/168457\" width=\"60px\" ></a>\r\n<a href=\"https://github.com/SAP\" title=\"SAP\" > <img src=\"https://user-images.githubusercontent.com/7692328/204835214-d9d25b58-e3df-408d-87a3-c7d36b578ee4.png\" width=\"60px\" ></a>\r\n<a href=\"https://github.com/postmanlabs\" title=\"postman\" > <img src=\"https://user-images.githubusercontent.com/7692328/204835529-e9e290ad-696a-49ad-9d34-08e955704715.png\" width=\"60px\" ></a>\r\n<a href=\"https://github.com/react-native-community\" title=\"React Native Community\" > <img src=\"https://avatars.githubusercontent.com/u/20269980?v=4\" width=\"60px\" ></a>\r\n<a href=\"https://github.com/googleapis\" title=\"Google APIs\" > <img src=\"https://avatars.githubusercontent.com/u/16785467?v=4\" width=\"60px\" ></a>\r\n<a href=\"https://github.com/langchain-ai\" title=\"Langchain AI\" > <img src=\"https://avatars.githubusercontent.com/u/126733545?v=4\" width=\"60px\" ></a>\r\n<a href=\"https://github.com/withastro\" title=\"Astro websie builder\" > <img src=\"https://avatars.githubusercontent.com/u/44914786?v=4\" width=\"60px\" ></a>\r\n<a href=\"https://github.com/baidu\" title=\"Baidu\" > <img src=\"https://avatars.githubusercontent.com/u/13245940?v=4\" width=\"60px\" ></a>\r\n[more](./USERs.md)\r\n\r\n<small>The list of users are mostly published by Github or communicated directly. Feel free to contact if you find any information wrong.</small>\r\n\r\n---\r\n\r\n## Main Features\r\n\r\n<img align=\"right\" src=\"static/img/fxp_logo.png\" width=\"180px\" alt=\"FXP logo\"/>\r\n\r\n* Validate XML data syntactically\r\n* Parse XML to JS Object\r\n* Build XML from JS Object\r\n* Compatible to node js packages, in browser, and in CLI (click try me button above for demo)\r\n* Faster than any other pure JS implementation.\r\n* It can handle big files (tested up to 100mb).\r\n* Controlled parsing using various options\r\n* XML Entities, HTML entities, and DOCTYPE entites are supported.\r\n* unpaired tags (Eg `<br>` in HTML), stop nodes (Eg `<script>` in HTML) are supported.\r\n* You can restore almost same XML from JSON\r\n* Supports comments\r\n* It can preserve Order of tags in JS object\r\n* You can control if a single tag should be parsed into array.\r\n* Supports parsing of PI (Processing Instruction) tags with XML declaration tags\r\n* And many more other features.\r\n\r\n## v5\r\nI developed v5 in Apr 2023. And I didn't get the chance to complete all the features. I've ensured that new features don't impact performance. With v5, you have more control on parsing output. Check [docs](./docs/v5) for syntax help and basic understanding.\r\n\r\nPlease leave a comment in discussion forum for your suggestions and if you really need v5.\r\n\r\n## How to use\r\n\r\nTo use as package dependency\r\n`$ npm install fast-xml-parser` \r\nor \r\n`$ yarn add fast-xml-parser`\r\n\r\nTo use as system command\r\n`$ npm install fast-xml-parser -g` \r\n\r\nTo use it on a **webpage** include it from a [CDN](https://cdnjs.com/libraries/fast-xml-parser)\r\n\r\n**Example**\r\n\r\nAs CLI command\r\n```bash\r\n$ fxparser some.xml\r\n```\r\n\r\nIn a node js project\r\n```js\r\nconst { XMLParser, XMLBuilder, XMLValidator} = require(\"fast-xml-parser\");\r\n\r\nconst parser = new XMLParser();\r\nlet jObj = parser.parse(XMLdata);\r\n\r\nconst builder = new XMLBuilder();\r\nconst xmlContent = builder.build(jObj);\r\n```\r\n\r\nIn a HTML page\r\n```html\r\n<script src=\"path/to/fxp.min.js\"></script>\r\n:\r\n<script>\r\n  const parser = new fxparser.XMLParser();\r\n  parser.parse(xmlContent);\r\n</script>\r\n```\r\n\r\nBundle size\r\n\r\n| Bundle Name        | Size |\r\n| ------------------ | ---- |\r\n| fxbuilder.min.js   | 6.5K |\r\n| fxparser.min.js    | 20K  |\r\n| fxp.min.js         | 26K  |\r\n| fxvalidator.min.js | 5.7K |\r\n\r\n### Documents\r\n<table>\r\n  <tr><td>v3</td><td>v4</td><td>v5</td></tr>\r\n  <tr>\r\n    <td>\r\n      <a href=\"./docs/v3/docs.md\">documents</a>\r\n    </td>\r\n    <td><ol>\r\n      <li><a href=\"./docs/v4/1.GettingStarted.md\">Getting Started</a></li>\r\n      <li><a href=\"./docs/v4/2.XMLparseOptions.md\">XML Parser</a></li>\r\n      <li><a href=\"./docs/v4/3.XMLBuilder.md\">XML Builder</a></li>\r\n      <li><a href=\"./docs/v4/4.XMLValidator.md\">XML Validator</a></li>\r\n      <li><a href=\"./docs/v4/5.Entities.md\">Entities</a></li>\r\n      <li><a href=\"./docs/v4/6.HTMLParsing.md\">HTML Document Parsing</a></li>\r\n      <li><a href=\"./docs/v4/7.PITags.md\">PI Tag processing</a></li>\r\n    </ol></td>\r\n    <td><ol>\r\n      <li></li><a href=\"./docs/v5/1.GettingStarted.md\">Getting Started</a></li>\r\n      <li><a href=\"./docs/v5/2.Features.md\">Features</a></li>\r\n      <li><a href=\"./docs/v5/3.Options.md\">Options</a></li>\r\n      <li><a href=\"./docs/v5/4.OutputBuilders.md\">Output Builders</a></li>\r\n      <li><a href=\"./docs/v5/5.ValueParsers.md\">Value Parsers</a></li>\r\n    </ol></td>\r\n  </tr>\r\n</table>\r\n\r\n**note**: version 5 is released with version 4 tfor experimental use. Based on it's demand, it'll be developed and the features can be different in final release.\r\n\r\n## Performance\r\n<small>negative means error</small>\r\n\r\n### XML Parser\r\n\r\n<img align=\"left\" src=\"./docs/imgs/XMLParser_v4.png\" width=\"45%\" />\r\n<img src=\"./docs/imgs/XMLParser_large_v4.png\" width=\"47%\" />\r\n\r\n* Y-axis: requests per second\r\n* X-axis: File size\r\n\r\n### XML Builder\r\n\r\n<img src=\"./docs/imgs/XMLBuilder_v4.png\" width=\"50%\" />\r\n* Y-axis: requests per second\r\n\r\n\r\n\r\n<!-- [![](static/img/ni_ads_ads.gif)](https://github.com/NaturalIntelligence/ads/) -->\r\n\r\n\r\n## Usage Trend\r\n\r\n[Usage Trend of fast-xml-parser](https://npm-compare.com/fast-xml-parser#timeRange=THREE_YEARS)\r\n  \r\n<a href=\"https://npm-compare.com/fast-xml-parser#timeRange=THREE_YEARS\" target=\"_blank\">\r\n  <img src=\"https://npm-compare.com/img/npm-trend/THREE_YEARS/fast-xml-parser.png\" width=\"50%\" alt=\"NPM Usage Trend of fast-xml-parser\" />\r\n</a>\r\n\r\n## Supporters\r\n### Contributors\r\n\r\nThis project exists thanks to [all](graphs/contributors) the people who contribute. [[Contribute](docs/CONTRIBUTING.md)].\r\n<!-- <a href=\"graphs/contributors\"><img src=\"https://opencollective.com/fast-xml-parser/contributors.svg?width=890&button=false\" /></a> -->\r\n<!--\r\n### Lead Maintainers\r\n![Amit Gupta](https://avatars1.githubusercontent.com/u/7692328?s=100&v=4)\r\n[![Vohmyanin Sergey Vasilevich](https://avatars3.githubusercontent.com/u/783335?s=100&v=4)](https://github.com/Delagen)\r\n\r\n### All Contributors -->\r\n<a href=\"graphs/contributors\"><img src=\"https://opencollective.com/fast-xml-parser/contributors.svg?width=890&button=false\" /></a>\r\n\r\n### Backers\r\n\r\nThank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/fast-xml-parser#backer)]\r\n\r\n<a href=\"https://opencollective.com/fast-xml-parser#backers\" target=\"_blank\"><img src=\"https://opencollective.com/fast-xml-parser/backers.svg?width=890\"></a>\r\n\r\n\r\n\r\n# License\r\n* MIT License\r\n\r\n![Donate $5](static/img/donation_quote.png)\r\n","readmeFilename":"README.md","_rev":"1-afbdbc344e0065adfcc5b6eaafd587b2"}