Pure Actionscript HTML Parser (with thanks to John Resig)

Gary McGhee - Thursday, May 14, 2009
I am writing a Flex ecommerce store that needs to work with Mals Ecommerce. I am posting values to Mals to add to the cart, and the result is a HTML 4.0 page of the shopping cart, which I need to extract some information from. Parsing HTML would be much easier if it could be converted to XML for use with Flex's built in XML parser. At first I tried quoting unquoted attributes, but then found unclosed tags and it all seemed too hard, so I went looking for a HTML parser in ActionScript, with no success. Then i remembered that ActionScript is supposed to be a superset of Javascript, and the amount of serious code being written in Javascript these days continues to surprise me. This led to this Javascript HTML Parser whipped up by Javascript guru and JQuery creator John Resig.

With some quick hacking, here is my version.
Comments
Post has no comments.
Post a Comment




Captcha Image