# ltx

Latest version **3.1.2** (published 2025-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install ltx
pnpm add ltx
yarn add ltx
bun add ltx
```

## Health

**Score 38/100 (D)** — status: maintenance-mode.

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.2 |
| Published | 2025-01-11 |
| First published | 2011-01-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/ltx) |
| Module format | ESM + CommonJS |
| Node | >= 12.4.0 |
| Dependencies | 0 |
| Unpacked size | 65.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Astro |
| Maintainers | sonny, chris-rock, astro, lloydwatkin, xmppbot |

## Links

- npm: https://www.npmjs.com/package/ltx
- Repository: https://github.com/xmppjs/ltx
- Homepage: http://github.com/xmppjs/ltx
- Issues: http://github.com/xmppjs/ltx/issues
- npm.io page: https://npm.io/package/ltx

## Recent versions

- 3.1.2 (latest) — 2025-01-11
- 3.1.1 — 2024-12-12
- 3.1.0 — 2024-12-12
- 3.0.1 — 2024-12-12
- 3.0.0 — 2021-08-21
- 2.10.0 — 2020-09-08
- 2.9.2 — 2019-10-02
- 2.9.1 — 2019-10-02
- 2.9.0 — 2019-09-10
- 2.8.1 — 2018-11-17
- 2.8.0 — 2018-10-03
- 2.7.3 — 2018-09-26
- 2.7.2 — 2018-09-22
- 2.7.1 — 2017-03-09
- 2.7.0 — 2017-03-04
- … 49 more at https://npm.io/package/ltx/versions

## README

# ltx

`JavaScript XML library`

ltx is a fast XML builder, parser, serialization and manipulation library for JavaScript.

The builder is a convenient and succinct API to build XML documents represented in memory as JavaScript primitives that can be serialized to XML strings.

The parser can parse XML documents or streams and support [multiple parsers](#parsers).

Features:

- succinct API to build and manipulate XML objects
- parse XML strings
- parse XML streams
- [multiple parser backends](#parsers)
- [JSX](https://facebook.github.io/jsx/) compatible (with `ltx.createElement` pragma)
- [tagged template](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/template_strings) support `` ltx`<foo bar="${baz}">` ``

## Install

`npm install ltx`

## Parsers

By default ltx uses its own parser which is the fastest but doesn't support advanced XML features.
ltx supports third party parsers when such features are needed.

| parser                                            | ops/sec | JS  | stream |
| :------------------------------------------------ | ------: | :-: | :----: |
| [node-xml](https://github.com/dylang/node-xml)    |  22,292 |  ☑  |   ☑    |
| [libxmljs](https://github.com/polotek/libxmljs)   |  48,116 |  ☐  |   ☐    |
| [node-expat](https://github.com/astro/node-expat) |  63,805 |  ☐  |   ☑    |
| [sax-js](https://github.com/isaacs/sax-js)        |  79,375 |  ☑  |   ☑    |
| [saxes](https://github.com/lddubeau/saxes)        | 168,263 |  ☑  |   ☑    |
| **[ltx/src/parsers/ltx](lib/parsers/ltx.js)**     | 527,728 |  ☑  |   ☑    |

From [ltx/benchmarks/parsers.js](benchmarks/parsers.js), higher is better.
Node.js v14.17.0 - AMD Ryzen 9 5900HX

## Benchmark

```
npm run benchmark
```

## Test

```
npm install
npm test
```

---
_Source: https://npm.io/package/ltx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
