# xmlifyjs

> Convert between JavaScript objects and XML strings.

Latest version **1.0.0-0** (published 2019-02-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0-0 |
| Published | 2019-02-10 |
| First published | 2019-02-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Daniel Breiner |
| Maintainers | danielbreiner |
| Keywords | javascript, xml, convert, xml2js, js2xml |

## Links

- npm: https://www.npmjs.com/package/xmlifyjs
- Repository: https://github.com/DanielBreiner/XMLify
- Homepage: https://github.com/DanielBreiner/XMLify#readme
- Issues: https://github.com/DanielBreiner/XMLify/issues
- npm.io page: https://npm.io/package/xmlifyjs

## 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.0-0 (latest) — 2019-02-10
- 0.1.0 — 2019-02-03

## README

# XMLify
Convert between JavaScript objects and XML strings.

# Installation
With npm:
```
$ npm install xmlifyjs
```
or just download the file and paste it into your project

# Usage
## stringify(object, indentation?, linebreak?)
``` js
const XML = require('xmlify');

var obj = {
  item: {
    foo: 'bar',
    test: {
      hello: "world"
    }
  }
};

var xml = XML.stringify(obj);
```
results in
```xml
<item>
  <foo>bar</foo>
  <test>
    <hello>world</hello>
  </test>
</item>
```

### parameters
 - **object** A JavaScript Object, to be converted. Should not contain XML reserved characters.
 - *(optional)* **indentation** The string at the beginning of each line.
 - *(optional)* **linebreak** The string at the end of each line.

 
 Example:
``` js
var xml = XML.stringify(obj,"","");
```
results in
```
<item><foo>bar</foo><test><hello>world</hello></test></item>
```

## parse(string)
``` js
const XML = require('xmlify');

var text = "<item><foo>bar</foo><test><hello>world</hello></test></item>"

var xml = XML.parse(text); 
```
results in
``` js
Object
  item:
    foo: "bar"
    test:
      hello: "world"
```

### parameters
 - **string** A valid XML string.


## known limitations
- parse() can't read self-closing tags
- parse() can't read tags which have no content inside

## future plans
- add support for attributes
- add support for js arrays

## License
MIT © Daniel Breiner

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