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: Eli Zaretskii <eliz@gnu.org>
Cc: look@strawberrytea.xyz, emacs-devel@gnu.org
Subject: Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML
Date: Sun, 10 Mar 2024 20:15:14 +0700	[thread overview]
Message-ID: <CAP_d_8XDV0OHJN7OPpvgw1asC2nj3-k5Y6wTkO4pbc22OPFYPA@mail.gmail.com> (raw)
In-Reply-To: <861q8iw947.fsf@gnu.org>

On Sun, 10 Mar 2024 at 19:43, Eli Zaretskii <eliz@gnu.org> wrote:

> > I think I explained that: because there is nothing in the XML Schema
> > meta-schema that talks specifically of files and file names.
>
> Then how do programs that process such XML know where are file names?

By inside knowledge that is more nuanced than can be expressed in a
schema. Or by the virtue of the fact that a relative file name is also
valid as a relative URI reference and resolving it against a base URI
that names a file yields an URI also naming a file.

> > It might be possible to consider element content or attributes typed
> > as ‘anyURI’ to contain file names. It will incur false positives (when
> > an anyURI attribute actually contains a non-file URI) and false
> > negatives (when the schema of a document is not known to Emacs, or
> > when it does not specifically designate an element or attribute as
> > ‘anyURI’ even though it contains file names in practice).
>
> Is that what programs which process XML do?

I cannot, off the top of my head, name any program which processes XML
in a generic way (i.e. not specialized to a particular subtype, guided
only by schemas) *and also* handles files referenced.


> So how does rnc-validate-mode somehow always knows to indicate whether
> a given XML file is valid or not?

It doesn’t always.

It attempts to heuristically detect the file’s schema by file name
extension, or by the namespace or local name of its root element. If
that fails, it applies what it calls a “vacuous schema” — one by which
any well-formed XML is valid, and by which none of the elements or
attributes are known to be anyURI.


> If that's the best (not necessarily the easiest) we can do, I'm okay
> with doing that.  But in general, IMO ffap.el is full of problematic
> heuristics that is known to fail from time to time, so whenever we can
> avoid the guesswork, we should, even if it is not the easiest
> solution.

No argument from me here, but as long as we have heuristics, might as
well apply improvements to them.



  reply	other threads:[~2024-03-10 13:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-09 21:37 [PATCH] ffap.el: Exclude angle brackets from file names in XML StrawberryTea
2024-03-10  5:48 ` Eli Zaretskii
2024-03-10  6:04   ` LemonBreezes
2024-03-10  6:40     ` Eli Zaretskii
2024-03-10  7:20       ` Yuri Khan
2024-03-10  7:51         ` Eli Zaretskii
2024-03-10 10:30           ` Yuri Khan
2024-03-10 10:46             ` Eli Zaretskii
2024-03-10 12:17               ` Yuri Khan
2024-03-10 12:43                 ` Eli Zaretskii
2024-03-10 13:15                   ` Yuri Khan [this message]
2024-03-10 13:53                     ` Lynn Winebarger
2024-03-14  9:49 ` Eli Zaretskii

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_8XDV0OHJN7OPpvgw1asC2nj3-k5Y6wTkO4pbc22OPFYPA@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=look@strawberrytea.xyz \
    /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.