I seem to be having some trouble parsing the html to xml. Any suggestions where I might start to debug the messages below?

Editor note: I copy/pasted the code from this comment into a gist for easier reading. JF 12/13/2021