[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML
From: |
Eli Zaretskii |
Subject: |
Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML |
Date: |
Sun, 10 Mar 2024 12:46:04 +0200 |
> 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.
- [PATCH] ffap.el: Exclude angle brackets from file names in XML, StrawberryTea, 2024/03/09
- Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML, Eli Zaretskii, 2024/03/10
- Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML, LemonBreezes, 2024/03/10
- Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML, Eli Zaretskii, 2024/03/10
- Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML, Yuri Khan, 2024/03/10
- Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML, Eli Zaretskii, 2024/03/10
- Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML, Yuri Khan, 2024/03/10
- Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML,
Eli Zaretskii <=
- Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML, Yuri Khan, 2024/03/10
- Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML, Eli Zaretskii, 2024/03/10
- Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML, Yuri Khan, 2024/03/10
- Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML, Lynn Winebarger, 2024/03/10
Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML, Eli Zaretskii, 2024/03/14