node-htmlparser icon indicating copy to clipboard operation
node-htmlparser copied to clipboard

No DefaultHandler in master branch?

Open ghost opened this issue 12 years ago • 2 comments

I don't know whether I'm missing something or not, please tell me if I do and excuse me if this is too obvious but there is no DefaultHandler method of htmlparser object in master branch (version 2.0.0). I've tried using this library in my browser but when I inspect htmlparser (Tautologistics.NodeHtmlParser) object, it doesn't have such a method. However it works like a charm in 1.x version! is there something missing from this branch? or I'm missing something? Thanks in advance.

ghost avatar Oct 06 '12 06:10 ghost

I just ran into the same issue. I'm not sure where to go from here.

philipwalton avatar Oct 12 '12 20:10 philipwalton

I think you want to use HtmlBuilder instead - in the utils_example.js, I change var handler = new htmlparser.DefaultHandler(function(err, dom) { which produces a somewhat cryptic error var handler = new htmlparser.DefaultHandler(function(err, dom) { ^ TypeError: undefined is not a function to the following: var handler = new htmlparser.HtmlBuilder(function(err, dom) { and it works like a charm (though in that example you also need to change the variable 'class' which collides with the reserved keyword)

dmitris avatar Feb 12 '13 14:02 dmitris