feeder
v0.2.0
Published
A stream for converting xml product feeds to json
Downloads
272
Maintainers
Readme
feeder
Introduction
This project is a simple xml to json converter for the most common types of ecommerce product feeds.
Dependencies
Usage
var FeedStream = require('feeder')
, fs = require('fs');
fs.createReadStream('feed.xml')
.pipe(new FeedStream())
.pipe(process.stdout);
Options
newlines
-Boolean
print each product on a new linetrim
-Boolean
trim element textblacklist
-Array
blacklist keys from being emittedrename
-Object
rename keys e.g.{"before": "after"}
lowercaseKeys
-Boolean
lower case keysproductElement
-String
element name to mark the start and end of a product. Usually 'product' or some variation thereofextractAttrs
-Boolean
extract all element attributes into emitted objects
Example
FeedStream
accepts xml of approximately the following format:
<products>
<product>
<name> Wintermute </name>
<price> 2000.00 </price>
<currency> CHF </price>
</product>
<product>
<name> Neuromancer </name>
<price> 100000.00 </price>
<currency> BRL </currency>
</product>
</products>
and produces a stringified JSON object for each product:
{ name: 'Wintermute', price: '2000.00', currency: 'CHF' }
{ name: 'Neuromancer', price: '100000.00', currency: 'BRL'}
License
MIT