# @xml-tools/parser

> XML Parser Implemented in JavaScript

Latest version **1.0.11** (published 2021-06-03) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @xml-tools/parser
pnpm add @xml-tools/parser
yarn add @xml-tools/parser
bun add @xml-tools/parser
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2021-06-03 |
| First published | 2019-10-28 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 38.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 59 |
| Maintainers | oss_rima_bot, shahars, vadson71 |
| Keywords | xml, parser |

## Links

- npm: https://www.npmjs.com/package/@xml-tools/parser
- Repository: https://github.com/sap/xml-tools
- Homepage: https://github.com/sap/xml-tools#readme
- Issues: https://github.com/sap/xml-tools/issues
- npm.io page: https://npm.io/package/@xml-tools/parser

## Dependencies (1)

- [chevrotain](https://npm.io/package/chevrotain.md) 7.1.1

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.11 (latest) — 2021-06-03
- 1.0.10 — 2021-02-09
- 1.0.9 — 2021-01-20
- 1.0.8 — 2021-01-20
- 1.0.7 — 2020-06-29
- 1.0.6 — 2020-06-18
- 1.0.5 — 2020-05-17
- 1.0.4 — 2020-04-02
- 1.0.3 — 2020-02-19
- 1.0.2 — 2020-02-11
- 1.0.1 — 2020-01-28
- 1.0.0 — 2020-01-20
- 0.4.0 — 2019-11-20
- 0.3.4 — 2019-11-12
- 0.3.3 — 2019-11-11
- … 5 more at https://npm.io/package/@xml-tools/parser/versions

## README

[![npm (scoped)](https://img.shields.io/npm/v/@xml-tools/parser.svg)](https://www.npmjs.com/package/@xml-tools/parser)

# @xml-tools/parser

A Fault Tolerant XML Parser which produces a [Concrete Syntax Tree][cst].

This means that the Parser will **not** stop on the first error and instead attempt to perform automatic error recovery.
This also means that the CST outputted by the Parser may only have **partial** results.
For example, In a valid XML an attribute must always have a value, however in the CST produced
by this parser an attribute's value may be missing as the XML Text input is not necessarily valid.

The CST produced by this parser is often used as the input for other packages in the xml-tools scope, e.g:

- [@xml-tools/ast](../ast) As the input for building an XML AST.
- [@xml-tools/content-assist](../content-assist) As part of the input for the content assist APIs.

## Installation

With npm:

- `npm install @xml-tools/parser`

With Yarn

- `yarn add @xml-tools/parser`

## Usage

Please see the [TypeScript Definitions](./api.d.ts) for full API details.

A simple usage example:

```javascript
const { parse } = require("@xml-tools/parser");

const xmlText = `<note>
                     <to>Bill</to>
                     <from>Tim</from>
                 </note>
`;

const { cst, lexErrors, parseErrors } = parse(xmlText);
console.log(cst.children["element"][0].children["Name"][0].image); // -> note
```

## Support

Please open [issues](https://github.com/SAP/xml-tols/issues) on github.

## Contributing

See [CONTRIBUTING.md](./CONTRIBUTING.md).

[cst]: https://en.wikipedia.org/wiki/Parse_tree

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