From: Jean-Christophe Helary <lists@traduction-libre.org>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: and nXML mode
Date: Wed, 11 Aug 2021 09:41:03 +0900 [thread overview]
Message-ID: <0EE17D49-3E90-4BDA-8D8D-0343B194A7FF@traduction-libre.org> (raw)
In-Reply-To: <CAP_d_8UJ6kCBqgg+MwBK=zTqhgnnbY07JQg7JdYjhBD1PAX1jA@mail.gmail.com>
> On Aug 9, 2021, at 14:57, Yuri Khan <yuri.v.khan@gmail.com> wrote:
>
> 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 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 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">
When I put that at the top of my file, nxml says "unexpected token".
> (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 " " ><!-- no-break space = non-breaking
> space, U+00A0 ISOnum -->
>
> and that’s what makes 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.)
Thank you for explaining the process. I was not aware of how processors handled the thing.
But I guess trying to make nxml be aware all this goes well beyond the scope of my work, so I'll just use html-mode.
--
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/
next prev parent reply other threads:[~2021-08-11 0:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-09 2:22 and nXML mode Jean-Christophe Helary
2021-08-09 5:57 ` Yuri Khan
2021-08-11 0:41 ` Jean-Christophe Helary [this message]
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=0EE17D49-3E90-4BDA-8D8D-0343B194A7FF@traduction-libre.org \
--to=lists@traduction-libre.org \
--cc=help-gnu-emacs@gnu.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.