Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derhuerst/hyper-xml
A DSL to create JSON trees compatible with xml-reader.
https://github.com/derhuerst/hyper-xml
h2 h2spec hyper json tree xml
Last synced: 6 days ago
JSON representation
A DSL to create JSON trees compatible with xml-reader.
- Host: GitHub
- URL: https://github.com/derhuerst/hyper-xml
- Owner: derhuerst
- License: isc
- Created: 2017-09-13T14:01:36.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-05T10:42:29.000Z (over 4 years ago)
- Last Synced: 2024-10-03T23:54:30.538Z (about 1 month ago)
- Topics: h2, h2spec, hyper, json, tree, xml
- Language: JavaScript
- Homepage: https://github.com/derhuerst/hyper-xml
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# hyper-xml
**A [DSL](https://en.wikipedia.org/wiki/Domain-specific_language) to create JSON trees compatible with [`xml-reader`](https://www.npmjs.com/package/xml-reader).** Tries to comply with the [`h2spec`](https://github.com/hyper2/h2spec#specification).
[![npm version](https://img.shields.io/npm/v/hyper-xml.svg)](https://www.npmjs.com/package/hyper-xml)
[![build status](https://img.shields.io/travis/derhuerst/hyper-xml.svg)](https://travis-ci.org/derhuerst/hyper-xml)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/hyper-xml.svg)
[![chat on gitter](https://badges.gitter.im/derhuerst.svg)](https://gitter.im/derhuerst)## Installing
```shell
npm install hyper-xml
```## Usage
```js
const h = require('hyper-xml')const one = h('one', {a1: 'v1'}, [
h('two', [
h('three', {a2: 'v2', a3: 'v3'}),
'four'
])
])
````one` will look like this:
```js
{
type: 'element',
name: 'one',
attributes: {a1: 'v1'},
children: [{
type: 'element',
name: 'two',
children: [{
type: 'element',
name: 'three',
attributes: {a2: 'v2', a3: 'v3'}
}, {
type: 'text',
value: 'four'
}]
}]
}
```## Contributing
If you have a question or have difficulties using `hyper-xml`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/hyper-xml/issues).