JSPM

cos-fast-xml-parser

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 202
    • Score
      100M100P100Q71805F
    • License MIT

    Fork of fast-xml-parser@4.5.6 for COS Node.js SDK, with ES2020 syntax replaced for Node 9+ compatibility.

    Package Exports

    • cos-fast-xml-parser
    • cos-fast-xml-parser/src/fxp.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cos-fast-xml-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    fast-xml-parser

    [![NPM quality][quality-image]][quality-url] Coverage Status Try me NPM total downloads

    Validate XML, Parse XML to JS Object, or Build XML from JS Object without C/C++ based libraries and no callback.


    Checkout our new library Text2Chart that constructs flow chart out of simple text. Very helpful in creating or alayzing an algorithm, and documentation purpose

    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.


    Main Features

    FXP logo
    • Validate XML data syntactically
    • Parse XML to JS Object
    • Build XML from JS Object
    • Compatible to node js packages, in browser, and in CLI (click try me button above for demo)
    • Faster than any other pure JS implementation.
    • It can handle big files (tested up to 100mb).
    • Controlled parsing using various options
    • XML Entities, HTML entities, and DOCTYPE entites are supported.
    • unpaired tags (Eg <br> in HTML), stop nodes (Eg <script> in HTML) are supported.
    • You can restore almost same XML from JSON
    • Supports comments
    • It can preserve Order of tags in JS object
    • You can control if a single tag should be parsed into array.
    • Supports parsing of PI (Processing Instruction) tags with XML declaration tags
    • And many more other features.

    v5

    I 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 for syntax help and basic understanding.

    Please leave a comment in discussion forum for your suggestions and if you really need v5.

    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 Name Size
    fxbuilder.min.js 6.5K
    fxparser.min.js 20K
    fxp.min.js 26K
    fxvalidator.min.js 5.7K

    Documents

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

    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

    Thank you to all our backers! 🙏 [Become a backer]

    License

    • MIT License

    Donate $5