From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Drop toplevel XML-comments in libxml-parse-(xml|html)-region? Date: Tue, 11 Nov 2014 17:28:27 +0100 Message-ID: References: <8761f4gcdk.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415723424 25709 80.91.229.3 (11 Nov 2014 16:30:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Nov 2014 16:30:24 +0000 (UTC) Cc: emacs-devel To: Ulf Jasper Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 11 17:30:18 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XoEKf-0008HR-CQ for ged-emacs-devel@m.gmane.org; Tue, 11 Nov 2014 17:30:17 +0100 Original-Received: from localhost ([::1]:49589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoEKe-0003H2-Pk for ged-emacs-devel@m.gmane.org; Tue, 11 Nov 2014 11:30:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoEJJ-0001ke-GB for emacs-devel@gnu.org; Tue, 11 Nov 2014 11:28:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoEJD-0001kf-87 for emacs-devel@gnu.org; Tue, 11 Nov 2014 11:28:53 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:42635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoEJD-0001kS-21 for emacs-devel@gnu.org; Tue, 11 Nov 2014 11:28:47 -0500 Original-Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1XoEIu-0004yW-6o; Tue, 11 Nov 2014 17:28:28 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEXLoKL9+PhLHiWjeXH/ ///+//7ryMe9i4b45eSbZWQtn1HnAAACSklEQVQ4jW3UMYvbMBQA4NcarGSrIdd6LM5wZAsVnOsx 4ISsB5eSUaGgaHRrsOLtDK14Y4ghRv+2T85hK0e1RZ+fpPf0FPiau/GZlTyzbvA0nLkZuMGr5pxb R5yHf3p47EFw7WZbYr48jLAWKe8Xanl2ByumeXqLydpuMsKW0bwubUZxbXsPuhKCad3DywAbpgtE NAA1SeVBqSdRFBMxgqfZAJ940UQ0EGVp2+UIr52K8sjFGJHdA0a3CCPrtpgNJRFnREWLoYQwaKsx QlzRKIxiOpY8+gDfjShUFEtml2zuHTc8oSxC2pk2APs0wKqYGNYSAEWAl+BqqczRVihZlrRFN8I2 VYaloRKBXaSQVkMRt5kywlaKImwHeoRNNkF5DpWkK0mhHDffZCfaOJRU905D7cOVyicJQBfMXocE f9RUElQOANjl/A4oP5qHaeLDvCGQLgA+JmfXWDDvYdG4krPCgz6PqW2otJJAwu+kewdSMk3wzYfA Hga4eLAP7IcoFjDVINjlPuJEEaJMAYLE23wV2CtFsLqjjkuSMfPVz9pBkLUOFmPDrUV5bujCS4q4 JAuvqemaVCy07Qrau/XeR3xcKpQB74ogWZz/jrA3jFqBXgFML4tq5j01yu5W3Np26sV7nHuJ/VVJ 6okm9yCPVfR2Japfaf0G67VrdXRv5yH3Ic+f3TPI893L7ecKHrf7UKqDovUfEGNsmgbjGAk2X05S /IJKw8wYSSegppDSwUGhiaWRaoYK+26hD57f/mTuxm692+3/B31i/wCWeVakhdZmeQAAAABJRU5E rkJggg== X-Now-Playing: Laetitia Sadier's _Something Shines_: "Butter Side Up" X-Hashcash: 1:23:141111:ulf.jasper@web.de::Gx/W1apAvDXS+LrR:000000000000000000000000000000000000000000002B8C X-Hashcash: 1:23:141111:emacs-devel@gnu.org::odfU+De3gKK5n4R7:000000000000000000000000000000000000000000gZvX In-Reply-To: <8761f4gcdk.fsf@web.de> (Ulf Jasper's message of "Tue, 28 Oct 2014 21:36:39 +0100") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-MailScanner-ID: 1XoEIu-0004yW-6o MailScanner-NULL-Check: 1416328108.73051@n4j734goui6sp1IyzVqfdg X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:176757 Archived-At: Ulf Jasper writes: > parse_region from xml.c, which is called by `libxml-parse-xml-region' > and `libxml-parse-html-region', makes some effort to retain top-level > comments in xml documents. If necessary it adds an artificial node at > the top of the parse tree. As a consequence one has to check whether > the result contains the "top" node or not (see below for an example). > This behaviour is different from that of `xml-parse-region' (from > xml.el), which just discards the toplevel comments. > > Can we make `libxml-parse-(xml|html)-region' consistent with > `xml-parse-region', i.e. can we drop the toplevel xml comments (and > simply call xmlDocGetRootElement)? I have no opinion in this, but this was added to the libxml code to make it possible to re-generate XML documents as is, which is not possible with the way `xml-parse-region' discards top-level comments. So I don't know what the right fix here is. On the one hand, it is (perhaps) surprising that comments are preserved (at all, anywhere) in the structure returned by the parser. However, stashing data that is to be further parsed by the HTML engine is a common feature that must be preserved. If we preserve comments further down in the DOM, then not preserving them at the top level seems inconsistent. But perhaps that inconsistency is fine? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no