<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;"><div>Hi Folks,<br></div><div><br></div><div>I was hoping I could use Mont's XMLHTMLParser to detect errors for me in my PEG parsing. Unfortunately, it fixes stuff!<br></div><div><br></div><div>Here, I have a missing </body> on the input stream<br></div><div><br></div><div><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>|document ios|<br></div><div><br></div><div>ios := ReadStream on: '<html><br></div><div><head><br></div><div></head><br></div><div>  <body><br></div><div><p>Dude</p><br></div><div></html>'.<br></div><div>document := XMLHTMLParser parse: ios.<br></div><div>document inspect.<br></div></blockquote><br></div><div>and the document shows it as fixed.<br></div><div><br></div><div>What I would like is for it to throw an error when content shows up outside any tags within the body tag.<br></div><div><br></div><div>For example this should pass: <br></div><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div><div>'<html<br></div><div>  <body><br></div><div>      <p>Dude</p><br></div><div>     </body><br></div><div></html>'.<br></div><div><br></div></div></blockquote><div>this should not<br></div><div><br></div><div><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div><div>'<html<br></div><div>  <body><br></div><div>      should throw an error<br></div><div>      <p>Dude</p><br></div><div>     </body><br></div><div></html>'.<br></div></div></blockquote></blockquote><br></div><div>Now, the XMLDOMParser throws a XMLWellFormednessException on any html, which I could use IF I can figure out how to get the XMLDOMParser to only barf on broken xHTML and display valid xHTML.<br></div><div><br></div><div><br></div><div>Hints appreciated.<br></div><div><br></div><div>thx</div><div><br></div><div><br></div><div><br></div></div><br></body></html>