Parsers can be made to not fail on first error. You return either a parsed structure or an array of found error.
Html5 parser is notoriously friendly to errors. See adoption agency algorithm.