[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#30789: 26.0.91; xml-parse-region works but libxml-parse-html-region
From: |
積丹尼 Dan Jacobson |
Subject: |
bug#30789: 26.0.91; xml-parse-region works but libxml-parse-html-region doesn't |
Date: |
Tue, 13 Mar 2018 11:29:50 +0800 |
Thank you for the patch but the real answer is to do what all other
browsers do... show as much as possible.
There is no browser out there that would dream of dying on the slightest
mistake.
Anyway if you guys are really going to use XML::LibXML::Parser (?) then
maybe loosen up some of
recover
/parser, html, reader/
recover from errors; possible values are 0, 1, and 2
A true value turns on recovery mode which allows one to parse broken
XML or HTML data. The recovery mode allows the parser to return the
successfully parsed
portion of the input document. This is useful for almost well-formed
documents, where for example a closing tag is missing somewhere. Still,
XML::LibXML will
only parse until the first fatal (non-recoverable) error occurs,
reporting recoverable parsing errors as warnings. To suppress even these
warnings, use
recover=>2.
Note that validation is switched off automatically in recovery mode.
validation
/parser, reader/
validate with the DTD; possible values are 0 and 1
ERROR REPORTING
XML::LibXML throws exceptions during parsing, validation or XPath
processing (and some other occasions). These errors can be caught by using eval
blocks. The error
is stored in $@. There are two implementations: the old one throws $@
which is just a message string, in the new one $@ is an object from the class
XML::LibXML::Error; this class overrides the operator "" so that when
printed, the object flattens to the usual error message.
XML::LibXML throws errors as they occur. This is a very common
misunderstanding in the use of XML::LibXML. If the eval is omitted, XML::LibXML
will always halt your
script by "croaking" (see Carp man page for details).
Also note that an increasing number of functions throw errors if bad
data is passed as arguments. If you cannot assure valid data passed to
XML::LibXML you should
eval these functions.
Note: since version 1.59, get_last_error() is no longer available in
XML::LibXML for thread-safety reasons.
bug#30789: 26.0.91; xml-parse-region works but libxml-parse-html-region doesn't, 積丹尼 Dan Jacobson, 2018/03/12