Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wenkesj/xml-compiler
:anchor: XML to JSON Compiler based on JXON https://developer.mozilla.org/en-US/docs/JXON
https://github.com/wenkesj/xml-compiler
Last synced: 5 days ago
JSON representation
:anchor: XML to JSON Compiler based on JXON https://developer.mozilla.org/en-US/docs/JXON
- Host: GitHub
- URL: https://github.com/wenkesj/xml-compiler
- Owner: wenkesj
- Created: 2015-08-26T18:30:49.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-08T20:32:08.000Z (almost 9 years ago)
- Last Synced: 2023-03-02T22:27:12.231Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# xml-compiler #
XML and JSON Compiler based on the documentation of [JXON](https://developer.mozilla.org/en-US/docs/JXON)```bash
npm install xml-compiler --save
```
# Try it out #
```bash
node example
```# API #
## new XMLCompiler(config) ##
Create a new instance of the **XMLCompiler**
+ config - Object based on [JXON](https://www.npmjs.com/package/jxon) [optional]## XMLCompiler.toJSON(DocObject) ##
Create a new JSON file from an XML file. Returns the corresponding JSON object from the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).**DocObject**
| Property | Type | Description | Required |
| -------- | ---- | ----------- | -------- |
| docPaths | Array (String) | Array of paths to the target files. | Yes |
| destDir | String | Path destination for the compiled files. | No |
| jsOut | Bool | Optional JS file to be added with the source of the JSON file in a require statement. | No |**For example**
```js
{
docPaths: ['some/path/to/file.xml'],
destDir: 'some/output/path'
}
```