GNU bug report logs - #46764
Extra ">" sails right past XML validator

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Thu, 25 Feb 2021 06:42:01 UTC

Severity: minor

Tags: notabug

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 46764 <at> debbugs.gnu.org
Subject: bug#46764: Extra ">" sails right past XML validator
Date: Thu, 25 Feb 2021 16:48:59 +0100
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:

> $ cat e.xml
> <?xml version="1.0" encoding="utf-8" ?>
> <M>></M>
> $ emacs e.xml
> says at the bottom: (nXML Valid)

I can confirm that this problem still exists in Emacs 28.

It seems to stem from this bit of code:

(defun xmltok-forward ()
  (setq xmltok-start (point))
  (let* ((case-fold-search nil)
	 (space-count (skip-chars-forward " \t\r\n"))
	 (ch (char-after)))
    (cond ((eq ch ?\<)
	   (cond ((> space-count 0)
		  (setq xmltok-type 'space))
		 (t
		  (forward-char 1)
		  (xmltok-scan-after-lt))))
	  ((eq ch ?\&)
	   (cond ((> space-count 0)
		  (setq xmltok-type 'space))
		 (t
		  (forward-char 1)
		  (xmltok-scan-after-amp 'xmltok-handle-entity))))
	  ((re-search-forward "[<&]\\|\\(]]>\\)" nil t)
	   (cond ((not (match-beginning 1))

So (xmltok-forward) on the ">" will just return `data'.  Is it checking
just < and & for validity on purpose?  Anybody remember what the thought
process might have been here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 144 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.