@hpcc-js/wasm-expat
v1.13.0
Published
hpcc-js - WASM expat
Maintainers
Readme
title: Expat description: WebAssembly wrapper for the libexpat XML parser outline: deep
@hpcc-js/wasm-expat
This package provides a WebAssembly wrapper around the libexpat library. This provides efficent SAX XML parsing.
Installation
::: code-group
npm install @hpcc-js/wasm-expatyarn add @hpcc-js/wasm-expatpnpm add @hpcc-js/wasm-expat:::
Usage
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);