Skip to content

Instantly share code, notes, and snippets.

@isaacs
Forked from tmpvar/sax-test.js
Created February 16, 2010 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/305195 to your computer and use it in GitHub Desktop.
Save isaacs/305195 to your computer and use it in GitHub Desktop.
var sys = require("sys"), sax = require("../sax-js/lib/sax");
parser = sax.parser(false);
sax.EVENTS.forEach(function (ev) {
parser["on" + ev] = function (n) { sys.puts(ev + " " + sys.inspect(n)); };
});
parser.write("<span>Welcome,</span> to monkey land").close();
/*
$ node sax-test.js
opentag {
"name": "SPAN",
"attributes": {}
}
text "Welcome,"
closetag "SPAN"
text " "
end undefined
ready undefined
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment