From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ulf Jasper Newsgroups: gmane.emacs.devel Subject: Drop toplevel XML-comments in libxml-parse-(xml|html)-region? Date: Tue, 28 Oct 2014 21:36:39 +0100 Message-ID: <8761f4gcdk.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1414528641 24470 80.91.229.3 (28 Oct 2014 20:37:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Oct 2014 20:37:21 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 28 21:37:14 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 1XjDVw-0006FD-OR for ged-emacs-devel@m.gmane.org; Tue, 28 Oct 2014 21:37:12 +0100 Original-Received: from localhost ([::1]:41337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjDVw-0006K1-9Q for ged-emacs-devel@m.gmane.org; Tue, 28 Oct 2014 16:37:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjDVa-0006IO-UB for emacs-devel@gnu.org; Tue, 28 Oct 2014 16:36:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjDVT-0004bt-DI for emacs-devel@gnu.org; Tue, 28 Oct 2014 16:36:50 -0400 Original-Received: from mout.web.de ([212.227.17.12]:49276) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjDVT-0004bk-2o for emacs-devel@gnu.org; Tue, 28 Oct 2014 16:36:43 -0400 Original-Received: from p55m-ud2 ([217.226.95.110]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0MNLNt-1Xl7JJ0lkv-006zIO; Tue, 28 Oct 2014 21:36:40 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Provags-ID: V03:K0:hCXNXyf/lVWms0gzFxXN7vpcI2kO90+3vPsjx5rTDVeZXJAmTOP rK08I+S+g3bPCgiUQzRhIHLhOst2AkPciWXIft2jdQVXD8e4WIT0tEzgO2yuTd/6CsXaXm4 uWGUogrUxVOL/aqSMX5EU33y3usyvqoSBl+I+bGfO22afgivMKMKQY3uyqcD7obhEo1wxUr oVdwU8pSOcPA7gkNgCcWA== X-UI-Out-Filterresults: notjunk:1; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 212.227.17.12 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:175941 Archived-At: --=-=-= Content-Type: text/plain Hi, 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)? Ulf ---------------------------------------------------------------------- Example: Calling (libxml-parse-xml-region (point-min) (point-max)) on --=-=-= Content-Type: text/xml Content-Disposition: inline bar --=-=-= Content-Type: text/plain results in (top nil (foo nil "bar") (comment nil "ignore me")) while for --=-=-= Content-Type: text/xml Content-Disposition: inline bar --=-=-= Content-Type: text/plain one gets (foo nil "bar") without the artificial node "top". --=-=-=--