Sunday, December 27, 2009

HTML parser for JavaScript

I needed an HTML parser for one of my projects. As I am using exclusively JavaScript lately (and loving it) I searched for a JavaScript solution. Envjs looked interesting but the messy source code (and global namespace pollution) was discomforting. Finally I decided to package Java HTML5 parser used in Envjs for NarwhalNarwhal.

The tricky part was to make the parser compatible with Sizzle but I am happy to report that they both work great together now. You can find the source code for the package here.

6 comments:

  1. Cool ! George, your stuff rocks ! Does your HTML5 parser / sizzle package allow to do DOM-like queries at serverside as in the browser ? That would open the doors to a PURE-like template language, where the template is pure HTML, and it would run on server and browser.
    ReplyDelete
  2. If you're using Javascript within a browser, there is an excellent HTML parsing library that you can use, which has been tested and works very well, and is actually the most used HTML parsing library on the web today: The browser itself.
    ReplyDelete
  3. Roberto, yeah it allows DOM-like queries. For example you can use jQuery or Sizzle to play with the DOM
    ReplyDelete
  4. dionyziz, the parser is intended for the server side. it emulates the browser so you can play with the DOM or use Sizzle or something. It is intended for web scraping etc...
    ReplyDelete
  5. I recently came across your post and have been reading along. I thought I would leave my first comment. I don't know what to say except that it caught my interest and you've provided informative points. I will visit this blog often.

    Thank you,

    Business Cash Advance
    ReplyDelete
  6. Every business needs a working capital source.
    At one point or another they will need an injection of cash
    MerchantFinanceConnection is Your source for Business Finance
    Solutions including Fast Cash,Merchant Cash Advances,
    Working Capital and Equipment Leasing.
    Discover today what we can do for you!
    Your Gateway to Business Finance
    Working Capital for Business
    ReplyDelete