Skip to content

Instantly share code, notes, and snippets.

@tmpvar
Created February 16, 2010 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tmpvar/305190 to your computer and use it in GitHub Desktop.
Save tmpvar/305190 to your computer and use it in GitHub Desktop.
// sax-test.js
var sys = require("sys"), sax = require("./sax");
parser = sax.parser(false);
sax.EVENTS.forEach(function (ev) {
parser["on" + ev] = function() { sys.puts(sys.inspect(arguments)); };
});
parser.write("<span>Welcome,</span> to monkey land");
// output
tmpvar@tmpvar:~/Work/Javascript/jsdom/example/pure$ node sax-test.js
{
"0": {
"name": "SPAN",
"attributes": {}
}
}
{
"0": "Welcome,"
}
{
"0": "SPAN"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment