Skip to content

@hpcc-js/wasm-expat

This package provides a WebAssembly wrapper around the libexpat library. This provides efficent SAX XML parsing.

Installation

sh
npm install @hpcc-js/wasm-expat
sh
yarn add @hpcc-js/wasm-expat
sh
pnpm add @hpcc-js/wasm-expat

Usage

typescript
import { Expat } from "@hpcc-js/wasm-expat";

const expat = await Expat.load();

const xml = ` \
    <root>
        <child xxx="yyy">content</child>
    </root>
`;

const callback = {
    startElement(tag, attrs) { console.log("start", tag, attrs); },
    endElement(tag) { console.log("end", tag); },
    characterData(content) { console.log("characterData", content); }
};

expat.parse(xml, callback);

Classes

Interfaces

Type Aliases

Reference

Released under the Apache-2.0 License.