Thursday 4 May 2017

How to parse and validate a string containing HTML

I need to know if a user inputed text is a valid HTML on the server. Regex cannot be used for parsing html.

I've tried jsdom and htmlparser2 but both seems to parse broken html without giving any errors.

<p> Hello <b>World</b> </p>

<div>Hi</span><div>There</span> invalid html
<div>Test</div</span>



via Vitim.us

No comments:

Post a Comment