2.0.0 • Published 8 years ago

kingdomjs v2.0.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
8 years ago

kingdomjs (v-2.0.0)

Build Status

experimenting with DOM and reflection, alternative fro xml2json conversions.

I also happen to be an expat who sometimes would rather not use xpath.

Installation

npm install kindomjs --save

Usage

let KingDOM = require('kingdomjs');

let atomString = '<entry><id>someId</id><title type="text">some title</title></entry>';
let atomEntry = new KingDOM(atomString).entry[0];

console.log(atomEntry.id[0]['#text']);      // out : someId
console.log(atomEntry.title[0]['#text']);   // out : some title
console.log(atomEntry.title[0]['@type']);   // out : text


// serialize to string
console.log(atomEntry['@toString']);