all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Jean-Christophe Helary <lists@traduction-libre.org>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: &nbsp; and nXML mode
Date: Mon, 9 Aug 2021 12:57:50 +0700	[thread overview]
Message-ID: <CAP_d_8UJ6kCBqgg+MwBK=zTqhgnnbY07JQg7JdYjhBD1PAX1jA@mail.gmail.com> (raw)
In-Reply-To: <31FB0752-BAB3-455A-B9F3-BA6948CE204A@traduction-libre.org>

On Mon, 9 Aug 2021 at 09:22, Jean-Christophe Helary
<lists@traduction-libre.org> wrote:

> Is there a reason why nXML mode refuses to consider &nbsp; entities as legit in a document that starts with:
>
> <!DOCTYPE html>
> <html xmlns="http://www.w3.org/1999/xhtml">

If you view that as an XML document (which is what nXML deals with),
without any preconceived knowledge of HTML5, there is nothing to
suggest that &nbsp; is legit.

In XML, an entity can be defined inline within the doctype declaration:

    <!DOCTYPE html [
      <!ENTITY nbsp "&#a0;">
    ]>

or by reference to an external entity definition:

    <!DOCTYPE html
      PUBLIC "-//W3C//DTD XHTML 1.1//EN"
      SYSTEM "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

(In the HTML5 spec, this is referred to as “obsolete permitted DOCTYPE
string”, and the obsoletion is from the HTML5 point of view. I.e. if
you use an HTML5-aware parser, <!DOCTYPE html> is sufficient to
declare an HTML5 document.)

If you fetch that url, you will see that it references a number of
modules, and if you chase references far enough, you will get to
http://www.w3.org/MarkUp/DTD/xhtml-lat1.ent which contains this as its
first significant line:

    <!ENTITY nbsp   "&#160;" ><!-- no-break space = non-breaking
space, U+00A0 ISOnum -->

and that’s what makes &nbsp; a valid entity reference in an XHTML document.

(XML processors normally have some shortcuts, such as DTD pre-cached
in the so-called XML catalog, so that they don’t have to fetch them
from the network each time. XML catalog is keyed by the PUBLIC and/or
SYSTEM identifiers but not by the doctype root element name.)



  reply	other threads:[~2021-08-09  5:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  2:22 &nbsp; and nXML mode Jean-Christophe Helary
2021-08-09  5:57 ` Yuri Khan [this message]
2021-08-11  0:41   ` Jean-Christophe Helary
2021-08-11  5:45   ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-08-11  6:19     ` Yuri Khan

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

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

  git send-email \
    --in-reply-to='CAP_d_8UJ6kCBqgg+MwBK=zTqhgnnbY07JQg7JdYjhBD1PAX1jA@mail.gmail.com' \
    --to=yuri.v.khan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=lists@traduction-libre.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.