24 lines
888 B
Markdown
24 lines
888 B
Markdown
|
|
# fast-xml-builder
|
||
|
|
Build XML from JSON
|
||
|
|
|
||
|
|
|
||
|
|
XML Builder was the part of [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) for years. But considering that any bug in parser may false-alarm the users who are only using builder, we have decided to split it into a separate package.
|
||
|
|
|
||
|
|
## Installation
|
||
|
|
|
||
|
|
```bash
|
||
|
|
npm install fast-xml-builder
|
||
|
|
```
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
```javascript
|
||
|
|
import XMLBuilder from 'fast-xml-builder';
|
||
|
|
|
||
|
|
const builder = new XMLBuilder();
|
||
|
|
const xml = builder.build({ name: 'value' });
|
||
|
|
```
|
||
|
|
|
||
|
|
fast-xml-builder fully support the response generated by fast-xml-parser. So you can use the maximum options as you are using for fast-xml-parser like `preserveOrder`, `ignoreAttributes`, `attributeNamePrefix`, `textNodeName`, `cdataTagName`, `cdataPositionChar`, `format`, `indentBy`, `suppressEmptyNode` and many more. Any change in parser will reflect here time to time.
|
||
|
|
|