sax-bastard
Easy-peasy XML parsing built on sax-js.
Last updated 8 years ago by tehshrike .
Original npm · Tarball · package.json
$ cnpm install sax-bastard 
SYNC missed versions from official npm registry.

sax is too much work, and xml2js only works if you never have tags with the same name!

sax-bastard is based on sax-js, but returns a hierarchy of objects, each one having these properties:

  • name (string): the tag name
  • text (string): any text content of the element that is not part of the XML hierarchy
  • attributes (object): the object's properties are the attribute names, the values are the attribute values
  • children (array): an array containing all of the objects representing any child elements

To install:

npm install sax-bastard

To use:

var parse = require('sax-bastard')
var obj = parse(xml_string, function(err) {
	console.log("This is an error object, because an error happened apparently!")
	console.log(err)
})

If an error happens and no error callback is provided, the parse() function returns the error object instead of the thing you were hoping for.

Current Tags

  • 1.0.2                                ...           latest (8 years ago)

4 Versions

  • 1.0.2                                ...           8 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
  • 0.0.1                                ...           8 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2016 © taobao.org |