unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: 46764@debbugs.gnu.org
Subject: bug#46764: Extra ">" sails right past XML validator
Date: Thu, 25 Feb 2021 16:48:59 +0100	[thread overview]
Message-ID: <87h7m0407o.fsf@gnus.org> (raw)
In-Reply-To: <87eeh5m3pj.5.fsf@jidanni.org> ("積丹尼 Dan Jacobson"'s message of "Thu, 25 Feb 2021 07:43:52 +0800")

積丹尼 Dan Jacobson <jidanni@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





  reply	other threads:[~2021-02-25 15:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 23:43 bug#46764: Extra ">" sails right past XML validator 積丹尼 Dan Jacobson
2021-02-25 15:48 ` Lars Ingebrigtsen [this message]
2021-02-26  9:21 ` Mattias Engdegård
2021-02-26  9:30   ` Lars Ingebrigtsen
2021-02-26 10:28     ` Mattias Engdegård
2021-02-27 10:44     ` 積丹尼 Dan Jacobson
2021-02-26 16:00   ` bug#46764: [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7m0407o.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=46764@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).