unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Yuri Khan <yuri.v.khan@gmail.com>
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 12:46:04 +0200	[thread overview]
Message-ID: <865xxuwej7.fsf@gnu.org> (raw)
In-Reply-To: <CAP_d_8VcxqOJHd+_YPKcZpTwfb+x10=3uqN7E_dD5irP8=GhRA@mail.gmail.com> (message from Yuri Khan on Sun, 10 Mar 2024 17:30:50 +0700)

> From: Yuri Khan <yuri.v.khan@gmail.com>
> Date: Sun, 10 Mar 2024 17:30:50 +0700
> Cc: look@strawberrytea.xyz, emacs-devel@gnu.org
> 
> On Sun, 10 Mar 2024 at 14:51, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > > Tags do not inherently mean anything in XML. Only a specific XML-based
> > > format definition gives them meaning, and there is no way for either a
> > > doctype definition or an XML Schema to say “elements named X
> > > definitely contain file names”. The closest is XML Schema’s anyURI
> > > datatype, but it might refer not necessarily to a local file but
> > > possibly to any other URI-addressed resource.
> >
> > Are you saying that applications using XML hard-code the meaning of
> > each tag that they need to process?  IOW, how does a program using
> > such an XML know that the value is a file name?
> 
> XML is a generic framework for designing formats. Each application
> designs a specific schema that defines which tags mean what.
> 
> For example, XHTML is an XML subtype in which the <img> element can
> have a src="…" attribute which contains an URI. In particular, it
> might contain a file name.
> 
> For another example, SVG is an XML subtype that does not define an
> <img> element; <img> is invalid if used in an SVG document. On the
> other hand, SVG has an <image> element whose href="…" attribute
> contains an URI.
> 
> 
> A program typically does not work with arbitrary XML. It works with a
> specific XML subtype, like OpenOffice with ODF (which is a ZIP archive
> containing, among others, some XML files) and Inkscape with SVG. In
> case an application is capable of understanding multiple XML-based
> formats, it must know beforehand which particular format a document is
> an instance of.
> 
> For example, when Firefox receives an HTTP response with a
> ‘Content-Type: application/xhtml+xml’ header, it interprets the
> response body as XHTML page; but with a ‘Content-Type: image/svg+xml’,
> it processes the body as an SVG image.
> 
> 
> (I did not expect you’d need a lecture on this.)

I don't, not the general lecture you gave above, anyway.  I know about
the XML schema.  I was surprised that you didn't (and AFAIU still
don't) suggest that we interpret the tags according to the schema.
AFAIR, we do have an XML mode which can parse the schema, so it seems
reasonable to expect that we could recognize file names using the
information in the schema without any guesswork.  If this is
impossible, please explain why not, but please be specific: refer to
what Emacs can know about an XML document using the existing XML
mode(s), and how that affects our ability to know which tags specify
file names.



  reply	other threads:[~2024-03-10 10:46 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 [this message]
2024-03-10 12:17               ` Yuri Khan
2024-03-10 12:43                 ` Eli Zaretskii
2024-03-10 13:15                   ` Yuri Khan
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

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