(strict, opt)
| 26100 | } |
| 26101 | |
| 26102 | function SAXStream (strict, opt) { |
| 26103 | if (!(this instanceof SAXStream)) { |
| 26104 | return new SAXStream(strict, opt) |
| 26105 | } |
| 26106 | |
| 26107 | Stream.apply(this) |
| 26108 | |
| 26109 | this._parser = new SAXParser(strict, opt) |
| 26110 | this.writable = true |
| 26111 | this.readable = true |
| 26112 | |
| 26113 | var me = this |
| 26114 | |
| 26115 | this._parser.onend = function () { |
| 26116 | me.emit('end') |
| 26117 | } |
| 26118 | |
| 26119 | this._parser.onerror = function (er) { |
| 26120 | me.emit('error', er) |
| 26121 | |
| 26122 | // if didn't throw, then means error was handled. |
| 26123 | // go ahead and clear error, so we can write again. |
| 26124 | me._parser.error = null |
| 26125 | } |
| 26126 | |
| 26127 | this._decoder = null |
| 26128 | |
| 26129 | streamWraps.forEach(function (ev) { |
| 26130 | Object.defineProperty(me, 'on' + ev, { |
| 26131 | get: function () { |
| 26132 | return me._parser['on' + ev] |
| 26133 | }, |
| 26134 | set: function (h) { |
| 26135 | if (!h) { |
| 26136 | me.removeAllListeners(ev) |
| 26137 | me._parser['on' + ev] = h |
| 26138 | return h |
| 26139 | } |
| 26140 | me.on(ev, h) |
| 26141 | }, |
| 26142 | enumerable: true, |
| 26143 | configurable: false |
| 26144 | }) |
| 26145 | }) |
| 26146 | } |
| 26147 | |
| 26148 | SAXStream.prototype = Object.create(Stream.prototype, { |
| 26149 | constructor: { |
nothing calls this directly
no outgoing calls
no test coverage detected