title: Handling HTML web-scraping errors in R with XML package
body: <p>I am trying to scrape a web page <a href="http://www.weatheroffice.gc.ca/city/pages/on-135_metric_e.html" rel="nofollow noreferrer">http://www.weatheroffice.gc.ca/city/pages/on-135_metric_e.html</a> like this one, and using the following code, I receive an error suggesting that the HTML is improper:</p>
  
  <pre><code>library(RCurl)
  library(XML)
  weather &lt;- getURL("http://www.weatheroffice.gc.ca/city/pages/on-135_metric_e.html")
  doc &lt;- htmlParse(weather)
  </code></pre>
  
  <p>I have seen <a href="https://stackoverflow.com/questions/10956480/error-using-xml-package-in-r">this</a> post which demonstrates how to use Internet Explorer and the <code>rcom</code> package to fix improperly formed HTML and then feed it to the parser.  However the HTML in question passes the validation at <a href="http://validator.w3.org" rel="nofollow noreferrer">http://validator.w3.org</a>.</p>
  
  <p>What other ways are there for handling an HTML parse-related error like this one with the XML package?  </p>