Menu

#17 Stop parsing the rest of document after getting enough information

2.8
open
nobody
None
5
2014-09-09
2014-09-06
changgeng
No

I wonder if we could add a new feature that allow Html cleaner to stop parsing the rest of document after getting enough information.

A real world requirement for this is in a project we are just interested in the information in <head> elements.

It will be great if there's a way to tell HTML cleaner just to stop after the end of head element.

This could be done either by making the HtmlTokenizer more extendable, or allowing providing callbacks to tagStart and/or tagEnd methods.

Discussion

  • changgeng

    changgeng - 2014-09-09

    Attached is a patch(based on revision 368) that could do the work, would you consider to merge it?

     

    Last edit: changgeng 2014-09-09
  • Scott Wilson

    Scott Wilson - 2014-09-09

    Thanks for the patch!

    I'll review it to see if we can include it in the next release - the case that you describe would seem reasonable.

     

Log in to post a comment.