saxml
v1.0.0
Published
Simple API for XML
Downloads
5
Readme
saxml
Simple API for XML in JavaScript.
Usage
let Saxml = require('saxml')
let saxml = new Saxml(strict, options)
saxml.on("error", function (e) {
console.error("error!", e)
// clear the error and resume
this._parser.error = null
this.resume()
})
saxml.on("opentag", function (d) {
// process data.
})
fs.createReadStream("foo.xml")
.pipe(saxStream)
// Or using write and close methods.
// saxStream.write('<foo>bar</foo>').close()
Events
The event names can be exported through the constructor Saxml
.
console.log(Saxml.events)
/* [
* "text",
* "processinginstruction",
* "sgmldeclaration",
* "doctype",
* "comment",
* "opentagstart",
* "attribute",
* "opentag",
* "closetag",
* "opencdata",
* "cdata",
* "closecdata",
* "error",
* "end",
* "ready",
* "script",
* "opennamespace",
* "closenamespace"
*/ ]