How to use sax.MAX_BUFFER_LENGTH:
3367 3368 3369 3370 3371 3372 3373 3374 3375 3376
} var parser = this clearBuffers(parser) parser.q = parser.c = '' parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH parser.opt = opt || {} parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase' parser.tags = []
How to use sax.STATE:
3935 3936 3937 3938 3939 3940 3941 3942 3943 3944
for (var s in sax.STATE) { sax.STATE[sax.STATE[s]] = s } // shorthand S = sax.STATE function emit (parser, event, data) { parser[event] && parser[event](data) }
How to use sax.EVENTS:
3482 3483 3484 3485 3486 3487 3488 3489 3490 3491
Stream = require('stream').Stream } catch (ex) { Stream = function () {} } var streamWraps = sax.EVENTS.filter(function (ev) { return ev !== 'error' && ev !== 'end' }) function createStream (strict, opt) {
How to use sax.createStream:
13 14 15 16 17 18 19 20 21
Writable.call(this, options); var self = this; var xmlParser = sax.createStream(true, {}); self.xmlParser = xmlParser; var tagName;
How to use sax.parser:
104 105 106 107 108 109 110 111 112 113
// Setup parser {{{ var parser; if (input instanceof stream.Stream) { parser = sax.createStream(true, {}); } else if (typeof input == 'string' || Buffer.isBuffer(input)) { parser = sax.parser(true); parser.on = function(event, cb) { // Quick binder to simulate on() behaviour parser['on' + event] = cb; return parser; };