-
Notifications
You must be signed in to change notification settings - Fork 4
/
481.txt
258 lines (185 loc) · 12.8 KB
/
481.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
[22] [DFN[XML MIME[RUBYB[型]@en[type]]]]は、多くの [[XML]] 関連仕様で [[XML]]
として扱われる[[媒体型]]です。
* 仕様書
[REFS[
- [46] [CITE@en[RFC 7303 - XML Media Types]] ([TIME[2014-07-07 20:56:43 +09:00]] 版) <http://tools.ietf.org/html/rfc7303>
- [29] <http://www.whatwg.org/specs/web-apps/current-work/complete.html#xml-mime-type>
]REFS]
[48] はじめ [[RFC 2376]] で定義されていましたが、改訂され [[RFC 3023]]
となりました。 [[RFC 3023]] への改訂は、長らく素案状態で放置されていましたが、
2014年にようやく [[RFC 7303]] となりました。
* 定義
[23] [DFN[XML MIME[RUBYB[型]@en[type]]]]は、
[FIG(list)[
- [CODE(MIME)@en[[[text/xml]]]]
- [CODE(MIME)@en[[[application/xml]]]]
- [CODE(MIME)@en[[[+xml]]]] で終わる[[MIME型]]
]FIG]
です [SRC[>>46]]。
;;
[24] [[RFC 3023]] は [[XML MIME型]]という語を使っていませんが、
「XML Media Types」と題した章で [[XML MIME実体]]のための[[MIME型]]として
[CODE(MIME)@en[[[text/xml]]]], [CODE(MIME)@en[[[application/xml]]]],
[CODE(MIME)@en[[[text/xml-external-parsed-entity]]]]、
[CODE(MIME)@en[[[application/xml-external-parsed-entity]]]]、
[CODE(MIME)@en[[[application/xml-dtd]]]] の5つを定義していました [SRC[>>57]]。
* MIME 型 [CODE(MIME)@en[text/xml]]
[64] [DFN[[CODE(MIME)@en[[[text/xml]]]]]] は、[[XML]] [[文書実体]]の
[[MIME型]]の1つです。
[FIG(quote)[
[FIGCAPTION[
[63] [[ECMA-376]] Second Edition, Part 1, 15.2.4
]FIGCAPTION]
>If no explicit MIME type exists for a specific XML format, text/xml shall be used. Consumers
who read a value of text/xml should determine the contents by the root namespace of the
contents of the part.
]FIG]
* MIME 型 [CODE(MIME)@en[[[application/xml]]]]
[65] [DFN[[CODE(MIME)@en[[[application/xml]]]]]] は、[[XML]] [[文書実体]]の
[[MIME型]]の1つです。
[66] [[XML]] の[[MIME型]]には他に [CODE(MIME)@en[[[text/xml]]]] がありますが、[[宗教上の理由]]から
[CODE(MIME)@en[[[application/xml]]]] を好む人もいます。
* 引数
[58] [CODE(MIME)@en[[[text/xml]]]] には次の[[引数]]があります。
[FIG(list short)[
- [CODE(MIME)@en[[[charset]]]]
- [CODE(MIME)@en[[[subtype]]]]
]FIG]
[67] [CODE(MIME)@en[[[application/xml]]]] には次の[[引数]]があります。
[FIG(list short)[
- [CODE(MIME)@en[[[charset]]]]
]FIG]
[68] [CODE(MIME)@en[[[*/*+xml]]]] [[構造化構文接尾辞]]共通の[[引数]]はありません。
* [CODE(MIME)@en[charset]] 引数
[25] 多くの [[XML MIME型]]は [CODE(MIME)@en[[[charset]]]] [[引数]]があり、
[[RFC 3023]] の定義によるとされています。詳しくは [[charset]]
の項をご覧ください。
[EG[
[REFS[
- [61] [CITE[My Last.fm -Last.fmで音楽を楽しもう-]] ([CODE[2007-09-24 13:30:31 +09:00]] 版) <http://lastfm.techno-st.net/atom.xml>
]REFS]
[[HTTP]] [CODE(HTTP)@en[[[Content-Type]]:]] には
[CODE(MIME)@en[[[text/xml]]]] とだけあります。
[[実体本体]]は [[UTF-8]] の [[XML]] [[文書実体]]で、
[[XML宣言]]に [CODE(charset)@en[[[UTF-8]]]]
と書かれています。
]EG]
[EG[
[REFS[
- [62] [CITE[FAQ@hiro. '''['''Atom feed''']''']] ([TIME[2007-09-24 13:43:47 +09:00]] 版) <http://potato.chips.jp/atom.xml>
]REFS]
>>61 と同じ (こちらは [[Atom 0.3]])。
]EG]
* 素片識別子
[26] 多くの [[XML MIME型]]では[[素片識別子]]は [[RFC 3023]]
の定義によるとされています。詳しくは[[素片識別子]]の項をご覧ください。
* [CODE(MIME)@en[*/*+xml]]
[30] [CODE(MIME)@en[[[text/xml]]]] と [CODE(MIME)@en[[[application/xml]]]]
の2つの[[MIME型]]や、 [CODE(MIME)@en[[[+xml]]]] で終わる[[MIME型]]を [[XML]]
のために使うことは、 [[RFC 3023]] で規定されています。
[33] なお、 [[RFC 3023]] は「[[XML MIME型]]」あるいは「[[XML媒体型]]」という用語は規定していません。
その題名こそ「XML Media Types」ではありますが、本文中では「XML Media Types」
という用語が登場せず、附属書で「XML MIME Types」が節題として使われているのみです。
[34] [[RFC 4287]] ([[Atom 1.0]]) は「XML media types」を [[RFC 3023]] から引用していますが、
>>33 のような状況なので規定の意味するところが曖昧になっています。
> If the value of "type" is an XML media type [RFC3023] or ends with "+xml" or "/xml" (case insensitive)
のような記述がわざわざあるので、これを定義とみなすなら、[[Web Applications 1.0]] の >>23
の定義よりはやや広いことになります。
[35] [[Web Applications 1.0]] ([[HTML5]]) は「XML MIME Types」を >>23 のように正確に定義しています。
** RFC 3023 を参照しない XML MIME 型
[32] [CODE(MIME)@en[[[+xml]]]] で終わる [[MIME型]]は普通 [[RFC 3023]] を引用していますが、
中にはそうでないものもあります。
- [28] [CODE(MIME)@en[[[application/owl+xml]]]]
-- 参照まったくなし
-- [CODE(MIME)@en[[[charset]]]] の定義は曖昧
-- [[素片識別子]]の定義なし
* [CODE(MIME)@en[+xml]] で終わらない XML の MIME 型
[31] [[RFC 3023]] 以前に使われ始めた [[MIME型]]や独自に決められた[[MIME型]]は、[CODE(MIME)@en[[[+xml]]]]
が最後についていません。これらは定義上、「[[XML MIME型]]」ではありません。
[FIG[
- [CODE(MIME)@en[[[text/xsl]]]] → [CODE(MIME)@en[[[application/xslt+xml]]]]
- [CODE(MIME)@en[[[application/smil]]]] → [CODE(MIME)@en[[[application/smil+xml]]]]
- [CODE(MIME)@en[[[text/x-cross-domain-policy]]]]
- [CODE(MIME)@en[[[text/xul]]]]
- [CODE(MIME)@en[[[text/cdf]]]], [CODE(MIME)@en[[[text/x-cdf]]]], [CODE(MIME)@en[[[application/cdf]]]],
[CODE(MIME)@en[[[application/x-cdf]]]]
]FIG]
[44] >>43 には >>31 も含む [[XML]] [[文書]]の [[MIME型]]の一覧があります。
[REFS[
- [43] [CITE[data-web-defs/data/mime-types.json at master · manakai/data-web-defs]] ([TIME[2014-03-23 04:57:03 +09:00]] 版) <https://github.com/manakai/data-web-defs/blob/master/data/mime-types.json>
]REFS]
* 歴史
** RFC 2376
[50] [DFN[[[RFC 2376]]]] は [CODE(MIME)@en[[[text/xml]]]] と
[CODE(MIME)@en[[[application/xml]]]] を定義していました。
[CODE(MIME)@en[[[application/xml]]]] はどんな [[XML実体]]
([[文書実体]]、[[外部部分集合実体]]、[[外部解析対象実体]]、
[[外部引数実体]]) にも使うことができ、
[CODE(MIME)@en[[[text/xml]]]] は [CODE(MIME)@en[[[text/*]]]]
の制約を ([[MIME]] で使うときは) 受けるとsらえていました [SRC[>>49]]。
[52] どちらにも [CODE(MIME)@en[[[charset]]]] [[引数]]があり、
省略可能であるものの'''強く[[推奨]]''' [SRC[>>49]] されていました。
しかしその[[値域]]はなぜか明記されていませんでした。
[53] [[UTF-8]] と [[UTF-16]] が特に推奨されていますが、 [[MIME]]
では [CODE(MIME)@en[[[text/xml]]]] で [[UTF-16]] を使えないことになっていました [SRC[>>49]]。
;; [55] [[HTTP]] から [[MIME]] へ変換する場合には、 [[UTF-16]] なら
[CODE(MIME)@en[[[text/xml]]]] から [CODE(MIME)@en[[[application/xml]]]]
に変更しなければ[['''ならない''']]とされていました [SRC[>>49]]。
[54] [CODE(MIME)@en[[[text/xml]]]] における[[既定値]]は [[MIME]] でも [[HTTP]]
でも [CODE(charset)@en[[[us-ascii]]]] で、 [CODE(MIME)@en[[[application/xml]]]]
では[[既定値]]を仮定するべきではないとされていました [SRC[>>49]]。
なぜか仮定することを禁止はされていませんでした。
[56] [[UTF-16]] から変換する場合には [[BOM]] を除去し、
[[UTF-16]] に変換する場合には [[BOM]] を追加する[['''べき''']]とされていました [SRC[>>49]]。
[51] 特定の[[XML応用]]の [[MIME型]]が必要なら [[RFC 2376]]
を基にするべきである [SRC[>>49]] とは述べているものの、
そのための特別な仕組みは用意されていませんでした。
[REFS[
- [49] [CITE@en[RFC 2376 - XML Media Types]] ([TIME[1998-07]] 版) <http://tools.ietf.org/html/rfc2376>
]REFS]
** RFC 3023
[REFS[
- [57] [CITE@en[RFC 3023 - XML Media Types]] ([TIME[2014-07-11 12:46:44 +09:00]] 版) <http://tools.ietf.org/html/rfc3023#section-3>
]REFS]
* メモ
[59] なんの説明もなしに、「XML 文書 = 拡張子 [CODE(file)[.xml]] = [[MIME]] [CODE[text/xml]]」のように説明している香具師はアホです。
[60] XML 文書一般に使える媒体型は、 [CODE[text/xml]] のほかに [CODE[[[application/xml]]]] があります。そして''後者が一般形''です。ですから、どちらを使えば良いのかわからない人は ''[CODE[application/xml]]'' を使うほうが安全です。 ([CODE[text/xml]] の方が適切なことはほとんどありません。)
[69] [[名前空間]]のある [[XML]] 文書には [[MIME]] [[媒体型]]は無力だとかで、 XML 文書はすべからく [WEAK[[CODE[[VAR[*]]/[VAR[*]]+xml]] ではなく]] [CODE[application/xml]] を使うべき、みたいな風潮があることに悪寒を感じます。
[70] 確かに名前空間を使うと XHTML と SVG の混ざった文書が作れます。だけど、それは XHTML が主の文書がなくなることも、 SVG が主の文書がなくなることも意味しない。依然 [CODE[application/xhtml+xml]] と [CODE[image/svg+xml]] の区別の意義は存在するはずです。どっちとも判断しがたい、文章と図が半々に混在した文書なら、そのときはじめて [CODE[application/xml]] の出番でしょう。だってそれは単なる XHTML とも単なる SVG とも違った使われ方を求めているんだから。
[71] 確かに媒体型の仕組みで伝え得る情報は不十分です。 [[CC/PP]] とか、他の仕組みも必要なのは事実。だけどそれは媒体型をないがしろにしてもいいことは意味しません。媒体型の支配する世界にいる限りは。
- [1] なんか、 [[XML]] の応用マーク付け言語系が増えるに従って [CODE[[VAR[*]]/[VAR[*]]+xml]] という[[媒体型]]名が増えて実装の対応が大変だからよくないんじゃ? とかあふぉなこと言ってる香具師がいるらしいですが・・・。
- [2] なんで [CODE[[[+xml]]]] なんてへんちくりんな接尾辞がついたんだかわかんないのかな? わかんないんだろーなー
- [3] 確かに、全部 [CODE[[[application/xml]]]] (あるいは + [[conneg]]) でいいじゃん?派もいることはいるけどねぇ。
- [4] >>3 でもあの [[ietf-xml-mime]] の大論争の結果があの [[RFC]] なわけで。
- [5] [CODE[application/[VAR[なんたら]]+rdf+xml]] 期待 age
[27] >>1-2 でもまあ、共通の処理モデルが [[RFC 3023]] とかで定義されていない以上、
仕方がない気もするわな。 [[RFC 3023]] って実際実装側にとって有意義なことほとんど書いてないじゃん。
[21]
[CITE[Bug 155730 – Mozilla doesn't handle files served as */*+xml as XML files]] ([CODE[2007-02-10 14:34:20 +09:00]] 版) <https://bugzilla.mozilla.org/show_bug.cgi?id=155730>
[36] [CITE@en[draft-murata-kohn-lilley-xml-03 - XML Media Types]]
([TIME[2009-09-25 02:28:26 +09:00]] 版)
<http://tools.ietf.org/html/draft-murata-kohn-lilley-xml>
[37] [CITE@en[Web Applications 1.0 r6661 Make the */*+xml handling be fallback handling, rather than overriding any registered handlers for specific XML types.]]
( ([TIME[2011-10-12 08:05:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=6660&to=6661>
[38] [CITE@EN[W3C XML Schema Definition Language (XSD) 1.1 Part 1: Structures]]
( ([TIME[2012-04-05 06:34:07 +09:00]] 版))
<http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/#web-representation>
[39] [CITE@en-US[XBL 2.0]]
( ([TIME[2012-05-03 02:23:03 +09:00]] 版))
<http://dev.w3.org/2006/xbl2/Overview.html#xml-mime-type>
[40] [CITE@en[draft-ietf-appsawg-xml-mediatypes-01 - XML Media Types]]
( ([TIME[2013-05-29 10:17:41 +09:00]] 版))
<http://tools.ietf.org/html/draft-ietf-appsawg-xml-mediatypes-01>
[41] [CITE@en[RFC 6839 - Additional Media Type Structured Syntax Suffixes]]
( ([TIME[2013-06-28 00:23:48 +09:00]] 版))
<http://tools.ietf.org/html/rfc6839#section-4.1>
[42] [CITE@en-US[XML Binding Language (XBL) 2.0]]
( ([TIME[2007-03-16 22:20:16 +09:00]] 版))
<http://www.w3.org/TR/2007/CR-xbl-20070316/#xml-mime>
[45] [CITE@en[RFC 7252 - The Constrained Application Protocol (CoAP)]]
( ([TIME[2014-06-27 00:59:37 +09:00]] 版))
<http://tools.ietf.org/html/rfc7252#page-93>
[47] [CITE[Index of /2006/02/son-of-3023]]
([TIME[2009-12-02 08:29:49 +09:00]] 版)
<http://www.w3.org/2006/02/son-of-3023/>