# @types/xml

> TypeScript definitions for xml

Latest version **1.0.11** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/xml
pnpm add @types/xml
yarn add @types/xml
bun add @types/xml
```

## Health

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

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2023-11-07 |
| First published | 2016-12-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51422 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/xml
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/xml
- npm.io page: https://npm.io/package/@types/xml

## Dependencies (1)

- [@types/node](https://npm.io/package/@types/node.md) *

## Recent versions

- 1.0.11 (latest) — 2023-11-07
- 1.0.9 (ts4.3) — 2023-08-30
- 1.0.8 (ts3.8) — 2022-01-18
- 1.0.6 (ts3.6) — 2021-07-02
- 1.0.5 (ts3.0) — 2020-05-21
- 1.0.4 (ts2.8) — 2019-11-15
- 1.0.3 (ts2.0) — 2019-02-14
- 1.0.10 — 2023-10-18
- 1.0.7 — 2021-12-16
- 1.0.2 — 2017-08-21
- 1.0.1 — 2017-02-23
- 1.0.0 — 2016-12-08

## README

# Installation
> `npm install --save @types/xml`

# Summary
This package contains type definitions for xml (https://github.com/dylang/node-xml).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/xml.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/xml/index.d.ts)
````ts
/// <reference types="node" />

declare namespace xml {
    interface Option {
        /**
         * String used for tab, defaults to no tabs (compressed)
         */
        indent?: string | undefined;
        /**
         * Return the result as a `stream` (default false)
         */
        stream?: boolean | undefined;
        /**
         * Add default xml declaration (default false)
         */
        declaration?:
            | boolean
            | {
                encoding?: string | undefined;
                standalone?: string | undefined;
            }
            | undefined;
    }

    interface XmlAttrs {
        [attr: string]: XmlAtom;
    }
    interface XmlDescArray {
        [index: number]: { _attr: XmlAttrs } | XmlObject;
    }
    interface ElementObject {
        push(xmlObject: XmlObject): void;
        close(xmlObject?: XmlObject): void;
    }

    type XmlAtom = string | number | boolean | null;
    type XmlDesc =
        | { _attr: XmlAttrs }
        | { _cdata: string }
        | { _attr: XmlAttrs; _cdata: string }
        | XmlAtom
        | XmlAtom[]
        | XmlDescArray;
    type XmlObject = { [tag: string]: ElementObject | XmlDesc } | XmlDesc;

    function element(...xmlObjects: XmlObject[]): ElementObject;
    function Element(...xmlObjects: XmlObject[]): ElementObject;
}

declare function xml(
    xmlObject: xml.XmlObject | xml.XmlObject[],
    options: { stream: true } & xml.Option,
): NodeJS.ReadableStream;
declare function xml(xmlObject?: xml.XmlObject | xml.XmlObject[], options?: boolean | string | xml.Option): string;

export = xml;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)

# Credits
These definitions were written by [Jianrong Yu](https://github.com/YuJianrong), and [Semyon Fomin](https://github.com/semyonf).

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