Really simple XML parsing
CoffeeScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
src
test
.gitignore
.travis.yml
Cakefile
LICENSE
README.md
package.json

README.md

Crack

[![Build Status] status] travis

Really simple XML parsing with libxmljs libxmljs.

Installation

npm install crack

Usage

crack = require 'crack'

data = '<?xml version="1.0" encoding="UTF-8"?>' +
       '<Items>' +
       '<Item>' +
       '<ASIN>0816614024</ASIN>' +
       '<ItemAttributes>' +
       '<Creator Role="Author">Gilles Deleuze</Creator>' +
       '<Creator Role="Contributor">Felix Guattari</Creator>' +
       '<Title>Thousand Plateaus</Title>' +
       '</ItemAttributes>' +
       '</Item>' +
       '</Items>'
doc = crack data

# Convert entire document to a JavaScript object.
console.dir doc.toJS()

# Drop down to a node.
doc.find 'Creator', (creator) ->
  console.dir creator