

HTML is often illegal. The SWI-Prolog parser will emit warnings, but often creates the intended parse tree. Typically, add the following options for processing arbitrary HTML if you are not interested in (minor) syntactical problems with the input.
syntax_errors(quiet)
max_errors(-1)