From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: mah@everybody.org (Mark A. Hershberger) Newsgroups: gmane.emacs.bugs Subject: Re: xml.el produces incorrect sexp for empty element. Date: Fri, 30 May 2003 15:38:57 -0500 Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87vfvsp3tq.fsf@batman.everybody.org> References: <87k7c8rbf3.fsf@batman.everybody.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1054327178 31553 80.91.224.249 (30 May 2003 20:39:38 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 30 May 2003 20:39:38 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 30 22:39:35 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Lqet-0008Bx-00 for ; Fri, 30 May 2003 22:39:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Lqgd-0000eA-0X for gnu-bug-gnu-emacs@m.gmane.org; Fri, 30 May 2003 16:41:15 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19LqgX-0000Ys-O3 for bug-gnu-emacs@gnu.org; Fri, 30 May 2003 16:41:09 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19Lqfx-0000Fq-Vd for bug-gnu-emacs@gnu.org; Fri, 30 May 2003 16:41:05 -0400 Original-Received: from batman.everybody.org ([66.93.249.200]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Lqfx-0008IZ-In for bug-gnu-emacs@gnu.org; Fri, 30 May 2003 16:40:33 -0400 Original-Received: from mah by batman.everybody.org with local (Exim 3.35 #1 (Debian)) id 19LqeP-0001cu-00; Fri, 30 May 2003 15:38:57 -0500 Original-To: Thien-Thi Nguyen X-URL: http://mah.everybody.org/weblog/ In-Reply-To: (Thien-Thi Nguyen's message of "30 May 2003 14:49:22 -0400") User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:5205 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:5205 Thien-Thi Nguyen writes: > mah@everybody.org (Mark A. Hershberger) writes: > > * xml.el (xml-parse-tag): Fixed incorrect handling of empty elements. > > because i'm not an xml expert i don't understand what was incorrect > before. could you reword this in the sense of: > > * xml.el (xml-parse-tag): Handle empty elements [IN CORRECT WAY]. > > w/ a touch more detail on the correction made? I did this with my previous patches, but since I made a mistake in that last patch, thank you for the opportunity to fix my mistake. The old xml-parse-region parses the following two bits of XML into different sexps. "" is parsed to ((xml nil (""))) while "" is parsed to ((xml nil)) states that "An element with no content is said to be empty.] The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag." So, "" is equivilent to "", but they don't parse the same in xml.el. The following patch and changelog fix the problem. mah@everybody.org (Mark A. Hershberger) writes: * xml.el (xml-parse-tag): Fixed handling of empty elements so that "" parses the same as "". *** xml.el.~1.18.~ Thu Mar 20 12:01:04 2003 --- xml.el Fri May 30 15:37:12 2003 *************** *** 221,228 **** ;; is this an empty element ? (if (looking-at "/[ \t\n\r]*>") (progn ! (forward-char 2) ! (nreverse (cons '("") children))) ;; is this a valid start tag ? (if (eq (char-after) ?>) --- 221,228 ---- ;; is this an empty element ? (if (looking-at "/[ \t\n\r]*>") (progn ! (goto-char (match-end 0)) ! (nreverse children)) ;; is this a valid start tag ? (if (eq (char-after) ?>) -- As long as you have mystery you have health; when you destroy mystery you create morbidity. -- G.K. Chesterson