📄 rfc3023.txt
字号:
Network Working Group M. Murata
Request for Comments: 3023 IBM Tokyo Research Laboratory
Obsoletes: 2376 S. St.Laurent
Updates: 2048 simonstl.com
Category: Standards Track D. Kohn
Skymoon Ventures
January 2001
XML Media Types
Status of this Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The Internet Society (2001). All Rights Reserved.
Abstract
This document standardizes five new media types -- text/xml,
application/xml, text/xml-external-parsed-entity, application/xml-
external-parsed-entity, and application/xml-dtd -- for use in
exchanging network entities that are related to the Extensible Markup
Language (XML). This document also standardizes a convention (using
the suffix '+xml') for naming media types outside of these five types
when those media types represent XML MIME (Multipurpose Internet Mail
Extensions) entities. XML MIME entities are currently exchanged via
the HyperText Transfer Protocol on the World Wide Web, are an
integral part of the WebDAV protocol for remote web authoring, and
are expected to have utility in many domains.
Major differences from RFC 2376 are (1) the addition of text/xml-
external-parsed-entity, application/xml-external-parsed-entity, and
application/xml-dtd, (2) the '+xml' suffix convention (which also
updates the RFC 2048 registration process), and (3) the discussion of
"utf-16le" and "utf-16be".
Murata, et al. Standards Track [Page 1]
RFC 3023 XML Media Types January 2001
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Notational Conventions . . . . . . . . . . . . . . . . . . . 4
3. XML Media Types . . . . . . . . . . . . . . . . . . . . . . 5
3.1 Text/xml Registration . . . . . . . . . . . . . . . . . . . 7
3.2 Application/xml Registration . . . . . . . . . . . . . . . . 9
3.3 Text/xml-external-parsed-entity Registration . . . . . . . . 11
3.4 Application/xml-external-parsed-entity Registration . . . . 12
3.5 Application/xml-dtd Registration . . . . . . . . . . . . . . 13
3.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4. The Byte Order Mark (BOM) and Conversions to/from the UTF-16
Charset . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5. Fragment Identifiers . . . . . . . . . . . . . . . . . . . . 15
6. The Base URI . . . . . . . . . . . . . . . . . . . . . . . . 15
7. A Naming Convention for XML-Based Media Types . . . . . . . 16
7.1 Referencing . . . . . . . . . . . . . . . . . . . . . . . . 18
8. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 18
8.1 Text/xml with UTF-8 Charset . . . . . . . . . . . . . . . . 19
8.2 Text/xml with UTF-16 Charset . . . . . . . . . . . . . . . . 19
8.3 Text/xml with UTF-16BE Charset . . . . . . . . . . . . . . . 19
8.4 Text/xml with ISO-2022-KR Charset . . . . . . . . . . . . . 20
8.5 Text/xml with Omitted Charset . . . . . . . . . . . . . . . 20
8.6 Application/xml with UTF-16 Charset . . . . . . . . . . . . 20
8.7 Application/xml with UTF-16BE Charset . . . . . . . . . . . 21
8.8 Application/xml with ISO-2022-KR Charset . . . . . . . . . . 21
8.9 Application/xml with Omitted Charset and UTF-16 XML MIME
Entity . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
8.10 Application/xml with Omitted Charset and UTF-8 Entity . . . 22
8.11 Application/xml with Omitted Charset and Internal Encoding
Declaration . . . . . . . . . . . . . . . . . . . . . . . . 22
8.12 Text/xml-external-parsed-entity with UTF-8 Charset . . . . . 22
8.13 Application/xml-external-parsed-entity with UTF-16 Charset . 23
8.14 Application/xml-external-parsed-entity with UTF-16BE Charset 23
8.15 Application/xml-dtd . . . . . . . . . . . . . . . . . . . . 23
8.16 Application/mathml+xml . . . . . . . . . . . . . . . . . . . 24
8.17 Application/xslt+xml . . . . . . . . . . . . . . . . . . . . 24
8.18 Application/rdf+xml . . . . . . . . . . . . . . . . . . . . 24
8.19 Image/svg+xml . . . . . . . . . . . . . . . . . . . . . . . 24
8.20 INCONSISTENT EXAMPLE: Text/xml with UTF-8 Charset . . . . . 25
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . 25
10. Security Considerations . . . . . . . . . . . . . . . . . . 25
References . . . . . . . . . . . . . . . . . . . . . . . . . 27
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 31
A. Why Use the '+xml' Suffix for XML-Based MIME Types? . . . . 32
A.1 Why not just use text/xml or application/xml and let the XML
processor dispatch to the correct application based on the
referenced DTD? . . . . . . . . . . . . . . . . . . . . . . 32
Murata, et al. Standards Track [Page 2]
RFC 3023 XML Media Types January 2001
A.2 Why not create a new subtree (e.g., image/xml.svg) to
represent XML MIME types? . . . . . . . . . . . . . . . . . 32
A.3 Why not create a new top-level MIME type for XML-based media
types? . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
A.4 Why not just have the MIME processor 'sniff' the content to
determine whether it is XML? . . . . . . . . . . . . . . . . 33
A.5 Why not use a MIME parameter to specify that a media type
uses XML syntax? . . . . . . . . . . . . . . . . . . . . . . 33
A.6 How about labeling with parameters in the other direction
(e.g., application/xml; Content-Feature=iotp)? . . . . . . . 34
A.7 How about a new superclass MIME parameter that is defined to
apply to all MIME types (e.g., Content-Type:
application/iotp; $superclass=xml)? . . . . . . . . . . . . 34
A.8 What about adding a new parameter to the Content-Disposition
header or creating a new Content-Structure header to
indicate XML syntax? . . . . . . . . . . . . . . . . . . . . 35
A.9 How about a new Alternative-Content-Type header? . . . . . . 35
A.10 How about using a conneg tag instead (e.g., accept-features:
(syntax=xml))? . . . . . . . . . . . . . . . . . . . . . . . 35
A.11 How about a third-level content-type, such as text/xml/rdf? 35
A.12 Why use the plus ('+') character for the suffix '+xml'? . . 36
A.13 What is the semantic difference between application/foo and
application/foo+xml? . . . . . . . . . . . . . . . . . . . . 36
A.14 What happens when an even better markup language (e.g.,
EBML) is defined, or a new category of data? . . . . . . . . 36
A.15 Why must I use the '+xml' suffix for my new XML-based media
type? . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
B. Changes from RFC 2376 . . . . . . . . . . . . . . . . . . . 37
C. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 38
Full Copyright Statement . . . . . . . . . . . . . . . . . . 39
1. Introduction
The World Wide Web Consortium has issued Extensible Markup Language
(XML) 1.0 (Second Edition)[XML]. To enable the exchange of XML
network entities, this document standardizes five new media types --
text/xml, application/xml, text/xml-external-parsed-entity,
application/xml-external-parsed-entity, and application/xml-dtd -- as
well as a naming convention for identifying XML-based MIME media
types.
XML entities are currently exchanged on the World Wide Web, and XML
is also used for property values and parameter marshalling by the
WebDAV[RFC2518] protocol for remote web authoring. Thus, there is a
need for a media type to properly label the exchange of XML network
entities.
Murata, et al. Standards Track [Page 3]
RFC 3023 XML Media Types January 2001
Although XML is a subset of the Standard Generalized Markup Language
(SGML) ISO 8879[SGML], which has been assigned the media types
text/sgml and application/sgml, there are several reasons why use of
text/sgml or application/sgml to label XML is inappropriate. First,
there exist many applications that can process XML, but that cannot
process SGML, due to SGML's larger feature set. Second, SGML
applications cannot always process XML entities, because XML uses
features of recent technical corrigenda to SGML. Third, the
definition of text/sgml and application/sgml in [RFC1874] includes
parameters for SGML bit combination transformation format (SGML-
bctf), and SGML boot attribute (SGML-boot). Since XML does not use
these parameters, it would be ambiguous if such parameters were given
for an XML MIME entity. For these reasons, the best approach for
labeling XML network entities is to provide new media types for XML.
Since XML is an integral part of the WebDAV Distributed Authoring
Protocol, and since World Wide Web Consortium Recommendations have
conventionally been assigned IETF tree media types, and since similar
media types (HTML, SGML) have been assigned IETF tree media types,
the XML media types also belong in the IETF media types tree.
Similarly, XML will be used as a foundation for other media types,
including types in every branch of the IETF media types tree. To
facilitate the processing of such types, media types based on XML,
but that are not identified using text/xml or application/xml, SHOULD
be named using a suffix of '+xml' as described in Section 7. This
will allow XML-based tools -- browsers, editors, search engines, and
other processors -- to work with all XML-based media types.
2. Notational Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119].
As defined in [RFC2781], the three charsets "utf-16", "utf-16le", and
"utf-16be" are used to label UTF-16 text. In this document, "the
UTF-16 family" refers to those three charsets. By contrast, the
phrases "utf-16" or UTF-16 in this document refer specifically to the
single charset "utf-16".
As sometimes happens between two communities, both MIME and XML have
defined the term entity, with different meanings. Section 2.4 of
[RFC2045] says:
"The term 'entity' refers specifically to the MIME-defined header
fields and contents of either a message or one of the parts in the
body of a multipart entity."
Murata, et al. Standards Track [Page 4]
RFC 3023 XML Media Types January 2001
Section 4 of [XML] says:
"An XML document may consist of one or many storage units" called
entities that "have content" and are normally "identified by
name".
In this document, "XML MIME entity" is defined as the latter (an XML
entity) encapsulated in the former (a MIME entity).
3. XML Media Types
This document standardizes five media types related to XML MIME
entities: text/xml, application/xml, text/xml-external-parsed-entity,
application/xml-external-parsed-entity, and application/xml-dtd.
Registration information for these media types is described in the
sections below.
Within the XML specification, XML MIME entities can be classified
into four types. In the XML terminology, they are called "document
entities", "external DTD subsets", "external parsed entities", and
"external parameter entities". The media types text/xml and
application/xml MAY be used for "document entities", while text/xml-
external-parsed-entity or application/xml-external-parsed-entity
SHOULD be used for "external parsed entities". The media type
application/xml-dtd SHOULD be used for "external DTD subsets" or
"external parameter entities". application/xml and text/xml MUST NOT
be used for "external parameter entities" or "external DTD subsets",
and MUST NOT be used for "external parsed entities" unless they are
also well-formed "document entities" and are referenced as such.
Note that [RFC2376] (which this document obsoletes) allowed such
usage, although in practice it is likely to have been rare.
Neither external DTD subsets nor external parameter entities parse as
XML documents, and while some XML document entities may be used as
external parsed entities and vice versa, there are many cases where
the two are not interchangeable. XML also has unparsed entities,
internal parsed entities, and internal parameter entities, but they
are not XML MIME entities.
If an XML document -- that is, the unprocessed, source XML document
-- is readable by casual users, text/xml is preferable to
application/xml. MIME user agents (and web user agents) that do not
have explicit support for text/xml will treat it as text/plain, for
example, by displaying the XML MIME entity as plain text.
Application/xml is preferable when the XML MIME entity is unreadable
by casual users. Similarly, text/xml-external-parsed-entity is
Murata, et al. Standards Track [Page 5]
RFC 3023 XML Media Types January 2001
preferable when an external parsed entity is readable by casual
users, but application/xml-external-parsed-entity is preferable when
a plain text display is inappropriate.
NOTE: Users are in general not used to text containing tags such
as <price>, and often find such tags quite disorienting or
annoying. If one is not sure, the conservative principle would
suggest using application/* instead of text/* so as not to put
information in front of users that they will quite likely not
understand.
The top-level media type "text" has some restrictions on MIME
entities and they are described in [RFC2045] and [RFC2046]. In
particular, the UTF-16 family, UCS-4, and UTF-32 are not allowed
(except over HTTP[RFC2616], which uses a MIME-like mechanism). Thus,
if an XML document or external parsed entity is encoded in such
character encoding schemes, it cannot be labeled as text/xml or
text/xml-external-parsed-entity (except for HTTP).
Text/xml and application/xml behave differently when the charset
parameter is not explicitly specified. If the default charset (i.e.,
US-ASCII) for text/xml is inconvenient for some reason (e.g., bad web
servers), application/xml provides an alternative (see "Optional
parameters" of application/xml registration in Section 3.2). The
same rules apply to the distinction between text/xml-external-
parsed-entity and application/xml-external-parsed-entity.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -