https://github.com/oresoftware/xml.json
Convert XML to JSON in a nice and consistent format
https://github.com/oresoftware/xml.json
nodejs npm xml xml-json xml-parser
Last synced: 11 months ago
JSON representation
Convert XML to JSON in a nice and consistent format
- Host: GitHub
- URL: https://github.com/oresoftware/xml.json
- Owner: ORESoftware
- License: mit
- Created: 2018-05-04T20:02:35.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-30T03:36:49.000Z (over 7 years ago)
- Last Synced: 2023-03-02T00:26:09.474Z (almost 3 years ago)
- Topics: nodejs, npm, xml, xml-json, xml-parser
- Language: TypeScript
- Size: 45.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Oresoftare / XML.js
## Stream XML and parse to JavaScript objects
#### Read from a file, or use a readable stream.
```javascript
import {XMLParser} from '@oresoftware/xml.js'
fs.createReadStream(file).pipe(new XMLParser()).once('result', function(result){
// your XML is now a JS object
});
```
### Now if you want to stream chunks of JS objects
```javascript
fs.createReadStream(file).pipe(new XMLParser({key: 'foobar'})).on('jschunk', function(c){
// represents a Node instance in your data
});
```
### Just pass in a file path:
The library will create a read stream for you.
```javascript
new XMLParser({file}).once('result', function(c){
// c represents a Node instance in your data
});
```