# simple-xml-writer

> Tiny and simple XML writer util for NodeJS

Latest version **0.0.2** (published 2012-01-11) · 0 weekly downloads

## Install

```sh
npm install simple-xml-writer
pnpm add simple-xml-writer
yarn add simple-xml-writer
bun add simple-xml-writer
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2012-01-11 |
| First published | 2011-09-14 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.4.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Pavel Minchenkov |
| Maintainers | minchenkov |
| Keywords | xml, writer |

## Links

- npm: https://www.npmjs.com/package/simple-xml-writer
- Repository: https://github.com/minchenkov/simple-xml-writer
- npm.io page: https://npm.io/package/simple-xml-writer

## Dependencies (1)

- [node-html-encoder](https://npm.io/package/node-html-encoder.md) 0.0.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

- 0.0.2 (latest) — 2012-01-11
- 0.0.1 — 2011-09-14

## README

# simple-xml-writer

Tiny and simple XML writer util for NodeJS

## Install
    npm install simple-xml-writer

## Examples

    var XmlWriter = require('simple-xml-writer').XmlWriter;

    var data = new XmlWriter(function(el) {
        el('root', function(el, at) {
            at('xmlns:c', 'http://schemas.xmlsoap.org/wsdl/');
            el('node', function(el, at) {
                at('name', 'foo');
                at('null_attr');
                at('empty_attr', '');

                el('value', 'foo');
                el('null_node');
                el('empty_node', '');
                el('encode', 'тест ß');
                el('c:value', 'text', function(el) {
                    el('encoding', 'tags:  <br />', function(el, at, text) {
                        at('quotes', '""');
                        el('dd', function(el, at, text) {
                            text('foo')
                            text('bar')
                        })
                    });
                });
            });
        });
    }, { addDeclaration: true });

    console.log(data.toString());

Output:

    <?xml version="1.0" encoding="UTF-8"?>
    <root xmlns:c="http://schemas.xmlsoap.org/wsdl/">
      <node name="foo" empty_attr="">
        <value>foo</value>
        <empty_node/>
        <encode>&#1090;&#1077;&#1089;&#1090; &#223;</encode>
        <c:value>
          <encoding quotes="&#34;&#34;">
            <dd>foobar</dd>
            tags:  &#60;br /&#62;
          </encoding>
          text
        </c:value>
      </node>
    </root>

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