From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson Newsgroups: gmane.emacs.bugs 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 Message-ID: <87vae0ac0h.fsf@jidanni.org> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1520911697 11677 195.159.176.226 (13 Mar 2018 03:28:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 13 Mar 2018 03:28:17 +0000 (UTC) Cc: Lars Ingebrigtsen , 30789@debbugs.gnu.org To: Katsumi Yamaoka Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 13 04:28:12 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1evabk-0002uf-Le for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Mar 2018 04:28:12 +0100 Original-Received: from localhost ([::1]:36803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evadn-0006zu-FL for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Mar 2018 23:30:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evadc-0006y1-6s for bug-gnu-emacs@gnu.org; Mon, 12 Mar 2018 23:30:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evadX-0007iK-9i for bug-gnu-emacs@gnu.org; Mon, 12 Mar 2018 23:30:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50019) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evadX-0007hX-28 for bug-gnu-emacs@gnu.org; Mon, 12 Mar 2018 23:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1evadW-00052P-1v for bug-gnu-emacs@gnu.org; Mon, 12 Mar 2018 23:30:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Mar 2018 03:30:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30789-submit@debbugs.gnu.org id=B30789.152091179519332 (code B ref 30789); Tue, 13 Mar 2018 03:30:01 +0000 Original-Received: (at 30789) by debbugs.gnu.org; 13 Mar 2018 03:29:55 +0000 Original-Received: from localhost ([127.0.0.1]:57916 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1evadP-00051j-8Q for submit@debbugs.gnu.org; Mon, 12 Mar 2018 23:29:55 -0400 Original-Received: from homie.mail.dreamhost.com ([208.97.132.208]:39699 helo=homiemail-a9.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1evadN-00051b-Ln for 30789@debbugs.gnu.org; Mon, 12 Mar 2018 23:29:53 -0400 Original-Received: from homiemail-a9.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a9.g.dreamhost.com (Postfix) with ESMTP id CAAB65BE070; Mon, 12 Mar 2018 20:29:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to:cc :subject:references:date:message-id:mime-version:content-type; s=jidanni.org; bh=6kustsNSDm1MRlRK+iOfpeL5htg=; b=ahskvyktpOiWf PZ/4S+zrgsNXwBrNbAimkBCRJaR2E1Sg48cZJndmJQ3y1C0N42aD4d52tfrD/rlN RXJneH6YDBDMGlCytWo0mRxtUHepVytq3eALUeilY2HQGLIHSXSd8JwUHdJBtFBY YWrgDbUluTiFdO5fLPj2eg4m4FGSwA= Original-Received: from jidanni.org (61-224-82-109.dynamic-ip.hinet.net [61.224.82.109]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jidanni@jidanni.org) by homiemail-a9.g.dreamhost.com (Postfix) with ESMTPSA id 944025BE06B; Mon, 12 Mar 2018 20:29:52 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:144176 Archived-At: 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.