Skip Menu |

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 57806
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: dwheeler [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Warning for Invalid Tag Not Silenced under recover => 2
Date: Mon, 24 May 2010 14:41:37 -0700
To: bug-xml-libxml [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
Here's the example: my $parser = XML::LibXML->new( recover => 2, no_network => 1, ); $parser->parse_html_string('<foo>hi</foo>'); print "Done\n"; And the output: HTML parser error : Tag foo invalid <foo>hi</foo> ^ Done By the "Done" I can see that it's not a fatal error. But because I've set `recover => 2` it shouldn't appear at all. Curiously, I get the same output if I add local $SIG{__WARN__}; So maybe it's libxml2 that's issuing the warning? Either way, I'd like it to stop, as I have a lot of bogus HTML to parse. XML::LibXML 1.70. Thanks, David
The attached patch (untested) should fix this bug. As a work-around you can add the following option to the parse_html_string call: $parser->parse_html_string('<foo>hi</foo>', { suppress_errors => 1 });
Subject: xml-libxml-bug57806.diff
Index: LibXML.pm =================================================================== --- LibXML.pm (revision 822) +++ LibXML.pm (working copy) @@ -1054,7 +1054,7 @@ # return (undef,undef) unless ref $opts; my $flags = 0; $flags |= 1 if exists $opts->{recover} ? $opts->{recover} : $self->recover; - $flags |= 32 if $opts->{suppress_errors}; + $flags |= 32 if exists $opts->{suppress_errors} ? $opts->{suppress_errors} : $self->recover_silently; $flags |= 64 if $opts->{suppress_warnings}; $flags |= 128 if exists $opts->{pedantic_parser} ? $opts->{pedantic_parser} : $self->pedantic_parser; $flags |= 256 if exists $opts->{no_blanks} ? $opts->{no_blanks} : !$self->keep_blanks;
Subject: Re: [rt.cpan.org #57806] Warning for Invalid Tag Not Silenced under recover => 2
Date: Tue, 25 May 2010 09:31:50 -0700
To: bug-XML-LibXML [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
On May 25, 2010, at 6:13 AM, Nick Wellnhofer via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=57806 > > > The attached patch (untested) should fix this bug.
Confirmed. Should a similar handling be added for suppressing warnings? Show quoted text
> As a work-around you can add the following option to the > parse_html_string call: > > $parser->parse_html_string('<foo>hi</foo>', { suppress_errors => 1 });
Also confirmed, thanks! David
Hi all, thanks for the report. The fix for a different issue report was already applied in XML-LibXML-1.76, so I'm closing this as FIXED. Regards, -- Shlomi Fish