emacs-devel
[Top][All Lists]
Advanced

[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: Yuri Khan
Subject: Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML
Date: Sun, 10 Mar 2024 17:30:50 +0700

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.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]