Hi Alex,<br><br>I puzzled about this for a while. Eventually I found this in the docs for XML::Error (<a href="http://libxml.rubyforge.org/rdoc/classes/LibXML/XML/Error.html">http://libxml.rubyforge.org/rdoc/classes/LibXML/XML/Error.html</a>)<br>

            <p>&gt; By default, warnings, errors and fatal errors that libxml generates are
            printed to STDERR via the XML::Error::VERBOSE_HANDLER proc. <br></p><p>&gt; To disable this output you can install the quiet handler:
            </p>
            <pre style="font-family: arial,helvetica,sans-serif;">&gt;     XML::Error.set_handler(&amp;XML::Error::QUIET_HANDLER)<br></pre><p>&gt; Install your own handler:
            </p>&gt;     XML::Error.set_handler do |error|
  <br>&gt;        puts error.to_s
<br>&gt;     end
            <p>&gt; Or remove all handlers:
            </p>&gt;     XML::Error.reset_handler<pre style="font-family: arial,helvetica,sans-serif;">So we&#39;ve been using something a bit like the second method mentioned above as we are trying to capture some sort of informative error message about<br>
what went wrong with the parsing to return the user.<br><br>Think there are some more examples in the test class for the error handler (tc_error.rb) if you have a look at the source.<br><br>regards<br><br>sam<br></pre><br>
<div class="gmail_quote">2009/4/23 Alex Wayne <span dir="ltr">&lt;<a href="mailto:alex@beautifulpixel.com">alex@beautifulpixel.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I am parsing a whole of imperfectly formed HTML.  In doing so, about<br>
1600 errors are generated and dumped to the log/console every time I<br>
parse this feed.  Yet it parses fine with the recover option.  But the<br>
options for supressing the messages don&#39;t appear to work.<br>
<br>
Here&#39;s my code:<br>
<br>
parser = LibXML::XML::HTMLParser.string(Downloader.get<br>
(url).clean_html,<br>
  :options =&gt; LibXML::XML::HTMLParser::Options::RECOVER |<br>
    LibXML::XML::HTMLParser::Options::NOERROR |<br>
    LibXML::XML::HTMLParser::Options::NOWARNING)<br>
page = parser.parse.root<br>
<br>
<br>
Is this the right way to declare the options for supressing errors and<br>
warnings?  Why aren&#39;t they actually supressed.  I would worry too much<br>
about this normally, but it appears after some profiling it appears<br>
printing and handling these errors takes about 20-40% of my total<br>
request time in my rails app, so its a fairly large performance issue.<br>
_______________________________________________<br>
libxml-devel mailing list<br>
<a href="mailto:libxml-devel@rubyforge.org">libxml-devel@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/libxml-devel" target="_blank">http://rubyforge.org/mailman/listinfo/libxml-devel</a><br>
</blockquote></div><br>