-
Notifications
You must be signed in to change notification settings - Fork 4
/
121.txt
2066 lines (1632 loc) · 115 KB
/
121.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
[135]
[DFN[[RUBYB[素片識別子] [fragment identifier]]]]は、
[[URL]] の一部分であり、[[素片識別子]]''以外''の部分により識別される[[資源]]の一部分、
あるいは[[表現]]の一種を識別するために使われます。
[349] [[URL]] に現れる [CODE[#]] とそれ以降の部分が[[素片識別子]]です。
* 仕様書
[REFS[
- [318] '''[CITE@en-US[URL Standard]] ([TIME[2014-07-28 16:26:47 +09:00]] 版) <http://url.spec.whatwg.org/#concept-url-fragment>'''
- [320] [CITE@en-US[URL Standard]] ([TIME[2014-07-28 16:26:47 +09:00]] 版) <http://url.spec.whatwg.org/#writing>
- [319] [CITE@en-US[URL Standard]] ([TIME[2014-07-28 16:26:47 +09:00]] 版) <http://url.spec.whatwg.org/#fragment-state>
- [146] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2014-09-02 22:35:05 +09:00]] 版) <http://www.whatwg.org/specs/web-apps/current-work/#the-indicated-part-of-the-document>
- [392] [CITE@en[Best Practices for Fragment Identifiers and Media Type Definitions]] ([TIME[2013-04-29 23:11:19 +09:00]] 版) <http://www.w3.org/2001/tag/doc/mimeTypesAndFragids>
-- [388] [CITE@en[Best Practices for Fragment Identifiers and Media Type Definitions]] ([TIME[2013-04-29 23:11:19 +09:00]] 版) <http://www.w3.org/2001/tag/doc/mimeTypesAndFragids#dfn-fragid>
-- [391] [CITE@en[Best Practices for Fragment Identifiers and Media Type Definitions]] ([TIME[2013-04-29 23:11:19 +09:00]] 版) <http://www.w3.org/2001/tag/doc/mimeTypesAndFragids#h-registrations>
-- [297] [CITE@en[Best Practices for Fragment Identifiers and Media Type Definitions]] ([TIME[2013-04-29 23:11:19 +09:00]] 版) <http://www.w3.org/2001/tag/doc/mimeTypesAndFragids#h-structures>
-- [358] [CITE@en[Best Practices for Fragment Identifiers and Media Type Definitions]] ([TIME[2013-04-29 23:11:19 +09:00]] 版) <http://www.w3.org/2001/tag/doc/mimeTypesAndFragids#authors>
- [257] [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-3>
- [387] [CITE@en[RFC 7049 - Concise Binary Object Representation (CBOR)]] ([TIME[2014-12-30 16:14:51 +09:00]] 版) <http://tools.ietf.org/html/rfc7049#section-7.5>
]REFS]
* 用語に関して
** 呼称
[136] '''俗称''':
[[DOM]] では、[[素片識別子]]を表す[[属性名]]として「[CODE(DOMa)@en[[[hash]]]]」
を使っています。これは、[[素片識別子]]の先頭を表す[[文字]]「[CODE(char)[#]]」
の俗称に由来しています。
[137] 特に [[HTML]] [[文書]]の[[素片識別子]]については、「[[アンカー]]」や
「[[アンカー名]]」と呼ばれることもあります。
[389] >>388 は [DFN[[[fragid]]]] と呼んでいます。
[21] '''日本語訳''':
「[[素片識別子]]」 (fragment identifier) は、
[DFN[フラグメント識別子]]、[DFN[断片識別子]]などとも訳されます。
** URI/URL と素片識別子
[22] [[RFC 2396]] においては[[素片識別子]]は [[URI]] の一部とはされていませんでした。
[[絶対URI]], [[相対URI]], [[素片識別子]]をあわせたものを
[[URI参照]]と呼んでいました。
[138]
新しい [[RFC 3986]] は、[[素片識別子]]を [[URI]] の一部としています。
[139]
非公式には、以前から[[素片識別子]]を [[URI]] の一部としている人も多くいました。
(単なる無知からそうしている人もいれば、そう定義するべきと考えてそうしている人もいました。)
[[HTML 4]] のように、[[素片識別子]]を [[URI]] の一部としない仕様書を参照しておきながら、
(「[[URI参照]]」ではなく) 「[[URI]]」という用語を使い、
しかも[[素片識別子]]も使えるような規定が含まれる仕様も存在し、
混乱の元となっていました。
* 内部参照に使う URI 参照としての素片識別子
[50] 同じ[[文書]]内で参照を行うためには [[SGML]]
の [CODE(SGML)[[[IDREF]]]]
のように専用の機構を用意しているものもありますが、
[[URI参照]]や [[IRI参照]]を採用して外部への参照と兼用していることもよくあります。
その場合、当然[[素片識別子]]が使われることになります。
素片識別子の構文と意味は、
その参照先の[[資源]]の[[表現]]の[[媒体型]]によります (>>24)。ですから、
そのような使い方をする文書形式では[[素片識別子]]の構文と意味が陽に定義されている必要があります。
[51] 特に [[XML]] 系の文書形式の仕様で、 [CODE(XML)[[[ID]]]]
属性を参照先として使っている場合には自明なためか明確に規定されることがあまりありません。
[52] 複数の語彙を組合わせる時にはとりわけ注意が必要です。
素片識別子の意味を組合せて使う仕様の仕様書で明確に規定しておかないと、
個々の仕様で解釈が割れていたり、
曖昧なものが含まれていたりする時に困ったことになります。
[53]
例: [[XML事象]]は [CODE(XMLa)[[[handler]]]] 属性などで
[[URI参照]]を使っていますが、
それが[[同文書参照]]である時の意味を特に規定していません。
意味的には [CODE(XML)[[[IDREF]]]] として扱われることが期待されていますが、
[[XML事象]]は[[ホスト言語]]と組合せて使うものですから、
その組合せの[[プロファイル]]でこれと矛盾しないように[[素片識別子]]の規定を行わなければなりません。
(その例: [[SVG 1.2]])
[CITE[XML Events]] <http://www.w3.org/TR/2003/REC-xml-events-20031014/>
* 部分資源を識別しない、あるいは何を識別するか未定義の場合
[140] 本来、[[媒体型]]についての[[素片識別子]]の仕様書は、
[[素片識別子]]がどのような[[部分資源]]を識別するのかを完全に定義するべきです。
例えば、 [CODE(HTMLa)@en[[[id]]]] [[属性]]の値が[[一致]]する[[要素]]を識別するような場合、
[[一致]]する[[要素]]が存在しない場合に何を識別するのか (しないのか)、
実装がどのように動作するべきなのかを規定しておくべきです。
[141] ですが、現実には、多くの仕様はそれを曖昧にしています。
更には、ほとんどの[[媒体型]]については、そもそも[[素片識別子]]が定義されていません。
[3] [[HTML]] [[文書]] ([CODE(MIME)@en[[[text/html]]]]) の場合、
[[文書]]内に存在しない[[素片識別子]]つきの [[URI参照]]を[[レンダリング]]させようとすると、
[[文書]]の最初を表示する [[Webブラウザ]]
[WEAK[(例: [[WinIE]] や [[Mozilla]] ([[Gecko]]))]] と、
最後を表示する [[Webブラウザ]] [WEAK[(例: [[Classic Mozilla]])]] があります。
* 意味
** 素片識別子と URI scheme
[23] URI の素片識別子と scheme 以外の部分の構文は、
[WEAK[(URI 全体の規定の範囲内で)]]
使用している [[URI scheme]] によって規定されています。
古くは素片識別子も URI scheme に依存すると考えられたこともあり、
古い URI scheme の中には素片識別子の扱いについて触れているものもあります。
しかし、現在では素片識別子は URI によって識別される[[資源]]の性質に依存するものであり、
'''URI scheme とは独立'''であると考えられています。
[142] [[URI scheme]] によっては、歴史的、その他の理由により、
構文的に[[素片識別子]]と矛盾する規定・実装がなされていることがあります。
詳しくは >>95 を参照してください。
[[#comment]]
** 素片識別子と基底 URL
@@ この項は書きかけです。 [[基底URL]] の解説とあわせて内容をなんとかしたいところです。。。
[79]
[CITE[The Linear Topic Map Notation]]
<http://www.ontopia.net/download/ltm.html#N565>
[[LTM]] ([[線形Topic Map記法]]) の [CODE@en[[[BASEURI]]]]
[[指令]]は、[[RFC 2396]] 的解釈に基づき、
[[素片識別子]]だけの [[URI]] には適用されないことになっています。
** 素片識別子と MIME 型
[24] URI の仕様書によれば、素片識別子の構文はその URI
参照による[[取出し]]行為
[WEAK[([[RDF]] のように仮想的な[Q[取出し]]行為も含まれます。)]]
の結果得られる[[資源]]の[[媒体型]]に依存するとされています。
[Q[取出し]]が行われなければ、素片識別子の構文と解釈はできず、
実質無制約になります [SRC[WebArch 3.2.1]]。
[25] URI 参照によって識別される資源は[[内容折衝]]の対象になっているかもしれません。
そうでなくても、一つの URI 参照に対応する資源を取出す手段
[WEAK[(仮想的なものかもしれません。)]] が複数あれば、
それぞれによって違うものが取出されるかもしれません。
動的表現 (>>26) をも一つの URI 参照に対応する[[資源]]の[[表現]]の一種と考えることもできます。
取出された資源の媒体型が異なると、同じ素片識別子であっても異なるものを指し得ます。
あるいは、一方に対しては構文や意味が定義されていなかったり正しくなかったりすることも起こり得ます。
実際に識別されるものが意味的に異なっている場合は、
鯖の設定の誤りと考えられます。構文や意味が未定義であるのは、
すべての媒体型が同じ機能を提供していないのですから仕方が無いことです。
[SRC[WebArch 3.2.2]]
このような問題をできるだけ避けるために、
各媒体型で素片識別子の構文や意味論は大きく変えてしまわないことが好ましいと考えられています。
[29] 素片識別子を媒体型から独立したものにしようという提案もありますが、
今のところ広く受け入れられてはいません。
- [CITE[A generic fragment identifier syntax]]
<http://www.rddl.org/fragment-syntax>,
<urn:ietf:id:draft-borden-frag-00>
[96]
[[URI]]が単なる所在指示子としてだけではなく、[[識別子]]として重要性を帯びてからは、
[[素片識別子]]もが[[取出し]]を伴わない文脈で用いられるようになりました。
仕様の側もそれを容認すると明記しています。
構文と[[素片識別子]]単体での意味も事実上不定になります。
(>>24, [WebArch], [RFC 3986])
[97]
この問題に遭遇した[[RDF]]は、
(当時の[[URI]]仕様である[[RFC 2396]]との整合性のため)
[Q[[[RDF URI参照]]における[[素片識別子]]は、[CODE(MIME)@en[[[application/rdf+xml]]]]で解釈することとする]]とのやや無理のある規定を設けています。
[104] '''[CODE(URI)@en[xmpp:]] URI scheme''':
[CODE(URI)@en[[[xmpp]]:]] [[URI scheme]]
では、 [[XMPP]] においては[[資源]]が[[表現]]を持たないので、
[[媒体型]]もなく、 [[RFC 3986]] にある通り実質無制約になり、
[[XMPP]] [[応用]]は好きに使って良い、とされています。
[SRC@en[[[RFC 4622]] 2.6]]
[98]
[[名前空間URI]]では[[局所名]]と結合した時に[[素片識別子]]付き[[URI]]となることを期待して[CODE(URI)[#]]で終わらせた[[URI]]を使うことがよくありますが、
これも[[取出し]]て得られる[[表現]]とは (あったとしても)
なんら関係がなく、単に形式的なものです。
[390] [[MIME型]]の [[IANA登録簿]]への登録には、[[素片識別子]]の情報を含められることになっています。
しかし登録時期が古い [[MIME型]]のほとんどには、[[素片識別子]]の情報が含まれていません。
[393] [[MIME型]]の[[素片識別子]]の解釈を定義するに当っては、
次の目標を念頭に調整しなければならない [SRC[>>391]] とされています。
[FIG(list)[
- [394] 特定の[[MIME型]]に対応している[[応用]]による処理と、
[[メタ書式]]がある場合にはその[[共通処理器]]による処理とが一貫した形にできること。
- [395] 同じ[[資源]]の[[表現]]で使う可能性のある他の [[MIME型]]の[[文書]]との[[内容折衝]]を促進すること。
- [396] [[スクリプト]]に対応している場合、[[著者]]が適宜[[応用]]の状態を[[素片識別子]]に[[符号化]]できること。
]FIG]
** 構造化構文と素片識別子
[403] [[XML]] や [[JSON]] のような[[構造化構文]]に関しては、
[[XPointer]] や [[JSON Pointer]] のように構文一般に適用される[[素片識別子]]の仕組みもありますし、
特定の[[応用]]で必要な[[素片識別子]]を規定することもあります。
[397] [[構造化構文]]の場合には、特定の[[MIME型]]の知識を持った[[応用]]と、
そうでない[[共通処理器]]とで[[素片識別子]]は同じものを識別する
[WEAK[(ように[[素片識別子]]の構文と意味が規定される)]] べきです [SRC[>>391]]。
;; [404] 特定の[[応用]]のみの[[素片識別子]]の構文と意味を規定してはいけないということではなく、
共通の構文と意味に矛盾しない形で拡張するべきだということです。
[398] これは[[構造化構文]]のみならず、 [CODE(MIME)@en[[[text/*]]]] や
[CODE(MIME)@en[[[image/*]]]] のような[[最上位型]]など、
[[共通処理器]]によって処理されるもの一般に適用される [SRC[>>391]] とされています。
[402] [[構造化構文]]の[[共通処理器]]による処理と[[最上位型]]の[[共通処理器]]による処理とが両方適用される場合、
両者で[[素片識別子]]の処理が衝突してしまうことが無いように規定するべきですが、
それができない場合には[[構造化構文接尾辞]]を使わないべきです [SRC[>>391]]。
[256] [[構造化構文接尾辞]] ([CODE(MIME)@en[[[+xml]]]] や [CODE(MIME)@en[[[+json]]]] のような接尾辞)
は [[IANA]] 登録時に[[素片識別子]]についての欄があります。 [[RFC 6839]] で登録されている接尾辞
([CODE(MIME)@en[[[+json]]]]、[CODE(MIME)@en[[[+ber]]]]、[CODE(MIME)@en[[[+der]]]]、
[CODE(MIME)@en[[[+fastinfoset]]]]、[CODE(MIME)@en[[[+wbxml]]]]、[CODE(MIME)@en[[[+zip]]]])
[SRC[>>257]] と [[RFC 7049]] の [CODE(MIME)@en[[[+cbor]]]] [SRC[>>387]]
に関しては、次のように規定があります。
[FIG(steps)[
= [258] [[構造化構文接尾辞]]の[[素片識別子]]の構文と意味は、相当する単体の [[MIME型]]の[[素片識別子]]の構文と意味と同じとする
= [259] 所属する[[MIME型]]の[[素片識別子]]の構文と意味は、
== [260] [[構造化構文接尾辞]]で定義されていて解決できる場合は、それによる
== [261] [[構造化構文接尾辞]]で定義されているが解決できない場合は、[[MIME型]]による
== [262] [[構造化構文接尾辞]]で定義されていない場合は、[[MIME型]]による
]FIG]
** 内容折衝との関係
[399] [[内容折衝]]により同じ [[URL]] で違う[[表現]]が返される可能性がある場合、
[[素片識別子]]は同等のものを指していることもあれば、
一方でしか存在しないものを指している場合や、一方ではエラーになる場合もあります。
同じ[[素片識別子]]が異なるものを指す場合もあり得ます。
;; [400] これは[[内容折衝]]を使うのが好ましくない理由の一つでもあります。
[401] [[MIME型]]の[[素片識別子]]を規定する場合には、[[内容折衝]]される可能性のある他の
[[MIME型]]との整合性を検討しなければならない [SRC[>>391]] と指摘されています。
[425] [[著者]]は、[[内容折衝]]で提供される[[表現]]間で同じ[[素片識別子]]が意味的に同じ構造を指すように、
また意味的に同じ構造は同じ[[素片識別子]]で参照できるようにする[['''べきです''']] [SRC[>>358]]。
[426] [[素片識別子]]を使って参照する場合は、何らかの手段で単一の[[表現]]しか無いと確認できない限り、
[[構文に基づく素片識別子構造]]を使う[['''べきではありません''']] [SRC[>>358]]。
;; [427] そのような手段は事実上存在しないので、実質的に[[著者]]以外は使わないよう求めていることになります...
** 動的表現との関係や状態保存のための用法
[410] [[文書]]の状態が[[スクリプト]]その他によって変化すると、
[[素片識別子]]が指すもの、あるいは差し得るものが変化することがあります。
また[[スクリプト]]が[[素片識別子]]を参照し、何らかの処理を実行したり、
表示状態を変化させたりすることがあります。
特に後者は、[[MIME型]]によって規定される[[素片識別子]]の意味を実質的に拡張するもの [SRC[>>391]]
です。
[EG[
[26] 例えばある XML 文書 <http://www.example.org/xml> で、
はじめ [SAMP(XML)[id]] という識別子は定義されていなかったとします。
この時、 URI 参照 <http://www.example.org/xml#id> は指すものがありません。
ところが、 Web ブラウザにおける何らかの処理の過程においてこの文書のある要素の
[CODE(XML)[[[ID]]]] が [SAMP(XML)[id]] と設定されたとします。すると
URI 参照 <http://www.example.org/xml#id> はその要素を識別するようになります。
このような状況は、便利なこともありますし、混乱を招くこともあります。
]EG]
[EG[
[27] ある XML 文書を [[XSLT]] [[スタイル・シート]]によって変換したとします。
変換した結果には、元の文書に存在していた [CODE(XML)[ID]]
が (それに対応する要素と共に) 残っているかもしれませんし、
残っていないかもしれません。ある[[原始要素]]に対応する[[結果要素]]の識別子は元とは違った識別子になっているかもしれません。
ある識別子に対応するのは原始要素に対応する結果要素とは違う
(関係のない別の) 要素かもしれません。元の文書とは無関係に、
スタイル・シートが新しい識別子を導入するかもしれません。
このような状況は、便利なこともありますし、混乱を招くこともあります。
]EG]
[EG[
[448] [[DocBook]] では同じ[[XML文書]]の[[要素]]は [CODE(XML)@en[[[IDREF]]]] 型の[[属性]]で参照できますが、
[[XInclude]] で取り込まれた部分の[[要素]]を参照する時には[[素片識別子]]を使う必要が生じます
[SRC[>>447]]。つまり [CODE(XML)@en[[[IDREF]]]] は読み込み時点での状態を指しており、
[[素片識別子]]は参照時点での状態を指していると思われます。
[REFS[
- [447] [CITE[DocBook V5.0]] ([TIME[2015-02-05 23:48:50 +09:00]] 版) <http://docbook.org/docs/howto/#changes-linking>
]REFS]
]EG]
[EG[
[165] [[Webアプリケーション]]では、1つの [[HTML]] [[文書]]が複数の「状態」を持つことがあります。
例えば [[Webメイル]]の[[メイル]]一覧画面を表す [[HTML]] [[文書]]1つで[[クライアント]]側[[スクリプト]]を使って日付順、送信者順など複数の表示方法を実現している場合に、
[[素片識別子]]にその「状態」の情報を詰め込むことで、1つの[[文書]]の「状態」を [[URL]]
として表すことができます。
]EG]
[166] [[スクリプト]]による状態保存に使う用法は元々 [CODE(HTMLa)@en[[[name]]]] や [CODE(HTMLa)@en[[[id]]]]
を表すものとして用意された [[HTML]] の[[素片識別子]]の使い方からは外れていますが、
ある[[資源]]の一部分や一表現法を表すとの [[URL]] 一般の[[素片識別子]]の意味論的には間違ってはいません。
[[URL]] の一部分という性質上、多量・大容量の「状態」を詰め込むのには適していませんが、
手軽に実現可能かつ[[ハイパーリンク]]可能な点が優れています。
[167] [[HTML5]] はこのような用法の応用への期待が高まっていることも踏まえて、
[CODE(DOMe)@en[[[hashchange]]]] [[事象]]を追加しました。
[411] [[著者]]は[[スクリプト]]による[[素片識別子]]の解釈が
[[MIME型]]による[[素片識別子]]の解釈と衝突しないようにする必要がありますから、
[[MIME型]]の[[素片識別子]]の規定の際は[[著者]]が動作を理解しやすいように配慮し、
[[著者]]がどのような構文を使うことができるのか明確にする必要があります。 [SRC[>>391]]
[412] 2011年頃には [CODE(URI)[[[''#!'']]]] を[[スクリプト]]による解釈に使う構文とすることが流行りました
(が2,3年で廃れました)。
;; [CODE(URI)[[[''#!'']]]] 参照。
;; [413] >>391 は >>411 のような構文の例として [CODE(URI)[[[''#!'']]]] を挙げています。
[EG[
[409] <https://twitter.com/#!/twitter> は <https://twitter.com/twitter>
に相当する内容が[[スクリプト]]によって表示されるようになっていました。
]EG]
[430] [[OAuth 2.0]] は[[鯖]]から[[利用者エージェント]]上で動作する
[[JavaScript]] [[応用]]への情報伝達に[[素片識別子]]を使っています (>>428)。
[431] [CODE(DOMm)@en[[[postMessage]]]] が実装される以前には、
異なる[[起源]]の [[URL]] (の [CODE(HTMLe)@en[[[iframe]]]] 内の[[文書]])
との通信に[[素片識別子]]を使う手法が用いられることもありました。
** 要約値の埋め込み
[143] [[素片識別子]]を、 [[URL]] によって識別される[[資源]]の[[表現]]が正当なものである、
あるいはある特定の版であることを確認するための[[ハッシュ値]]、
あるいは[[指紋]]を埋め込む場所として用いようとする提案があります。
[112]
[CITE[Link Fingerprints]] <http://www.gerv.net/security/link-fingerprints/>
([[名無しさん]] [WEAK[2006-11-11 03:36:08 +00:00]])
[144] 詳しくは [CODE(URI)@en[#[[hash]]()]] の項を参照してください。
[145] このような提案は、実装実験も行われている一方で、
元々の[[素片識別子]]の意味から逸脱しているとの批判もあります。
[150]
>>15 や >>90 のような[[版]]を指定する[[素片識別子]]もこれに類するといえるかもしれません。
** 履歴管理制御のための用法
[161] [[Webブラウザー]]によっては、[[素片識別子]]を含む [[URL]] 全体を[[未読]]かどうかの判定に用いています。
;; 例えば、 [[Firefox]] は [[URL]] 全体からリンク先が[[未読]]か[[既読]]かを判定し、
[CODE(CSS)@en[:[[visited]]]] [[擬似クラス]]に[[一致]]するかを決めています。
[[WinIE]] は[[素片識別子]]を除く [[URL]] によって判断しているようです。
[162] [[アンテナ]]や [[wiki]] の更新頁一覧などリンク先が頻繁に変更されることが前提となっている場面では、
[[Webブラウザー]]による[[未読]]・[[既読]]判定をある程度制御するため、
[[日付]]などの適当な文字列を[[素片識別子]]として付与することがあります。
[163] 例えば[[アンテナ]]が a.html が2009年12月31日に更新されたことを検知した場合、
[[URL]] として a.html#20091231 を使います。[[利用者]]がその[[リンク]]をたどると、
[[Webブラウザー]]は a.html#20091231 を[[履歴]]データベース上で[[既読]]とします。
[[利用者]]が次にその[[アンテナ]]の頁を見たときには、 a.html#20091231 へのリンクは[[既読]]になっています。
次に[[アンテナ]]が a.html が 2010年1月2日に更新されたことを検知すると、
[[URL]] は a.html#20100102 になります。[[利用者]]がその[[アンテナ]]の頁を見たときには
a.html#20100102 へのリンクは[[未読]]になっています。
[164] 同様の目的で[[照会]]を用いる方法もあります。[[照会]]を使えばどの[[Webブラウザー]]でもこの効果が得られるという利点がありますが、
[[素片識別子]]とは違って[[照会]]は実際に[[鯖]]に送信されるため相手方に動作が依存してしまうという欠点があります。
* 構文
** 素片識別子の始まり以外の [CODE(char)[#]]
[95] [[RFC 3986]]/[[RFC 3987]] の定義に従えば、 [[URI]] 中の[[文字]] [CODE(char)[#]]
は[[素片識別子]]のはじまりを表します。これは [[URI scheme]] によらず、
すべての [[URI]] に適用されます。
[62] ですが、現実には、[[URI]] の中で使われる[[文字]] [CODE(char)[#]]
が[[素片識別子]]の始まりとして扱われないことがあります
(もちろん'''仕様違反'''です)。
[63] [[Vodafone]] の独自 [[HTML]] 仕様では、 [CODE(URI)[[[tel]]:]]
[[URI scheme]] および [CODE(URI)[[[vtel]]:]] [[URI scheme]]
で[[電話]]の [CODE(char)[#]] ボタンの意味で生の
[CODE(URI)[#]] を使います。
[133]
'''[CODE(URI)@en[[[irc]]:]] [[URI scheme]]'''は、
[[IRC]]の[[チャンネル名]]に[CODE(char)[#]]が使われるのをそのまま[[URI]]で用いることがあり、
標準化案 ([[Internet Draft]]) もそれを容認し、さらに拡張しようとしていました。
[134]
[[Webブラウザ]]の実装では [CODE(URI)@en[[[data]]:]],
[CODE(URI)@en[[[javascript]]:]], [CODE(URI)@en[[[mailto]]:]]
のような [[URL scheme]] で [CODE(char)[#]] が[[素片識別子]]のはじまりとして扱われないことがあります。
;;
[131]
この記事はその例を紹介しています:
[CITE@ja[冬様もすなる☆日記というもの (2008年6月)]]
([[わかば]] 著, [CODE[2008-06-28 21:18:51 +09:00]] 版)
<http://suika.fam.cx/~wakaba/d/d200806#d28-1>
* 処理
** 誤り
[414] [[素片識別子]]は、それが[[文書]]中の何らかの部分を示す場合の他に、
構文的に誤りがある場合、構文的に誤ってはいないが指すものが存在しない場合があります。 [SRC[>>391]]
[415] しかし、そのような誤りであっても、
[FIG(list)[
- [416] [[文書]]中の何かではなく、[[文書]]が説明する何かを表す場合 ([[Semantic Web]] での用法)
- [417] [[活性内容]]が解釈する場合
- [418] [[内容折衝]]の他の[[表現]]では意味を持つ場合
]FIG]
... のように正当な理由があることもあります [SRC[>>391]]。
;; [419] >>418 が正当な理由と言えるのかは怪しいですが...
[420] ですから、[[MIME型]]の[[素片識別子]]の規定は構文の制約を設けるものではなく、
認識できる[[素片識別子]]をどう解釈するかを決めるものとなります [SRC[>>391]]。
解決できない[[素片識別子]]を与えられた[[応用]]の動作は、[[実装定義]]とするべきです
[SRC[>>391]]。
;; [421] >>415 のような理由があるから[[実装定義]]だと >>391 は言っていますが、
そうであるからこそ[[実装定義]]ではなく処理モデルを明確に決めないと[[相互運用性]]に問題が出る気がしますが...
** 文書の示された部分
[181] [[文書]]が [[DOM]] で表される場合、
「[DFN[[RUBYB[文書の示された部分]@en[the indicated part of the document]]]]」
は[[素片識別子]]によって表される[[文書]]の部分のことをいいます。
この場合に[[素片識別子]]から [[DOM]] の[[節点]]にどう対応付けられるかは、
その[[文書]]の[[MIME型]]の仕様によって決められることとなっています [SRC[>>146]]。
[359] 現時点でこれが明文化されているのは、 [[HTML]] ([CODE(MIME)@en[[[text/html]]]])
の場合 (>>360) のみです。
;; [367] [[文書の示された部分]]は、[[要素]]であることもあれば、
「[[文書]]の[RUBYB[先頭]@en[top]]」であることや、
存在しないこともあります。
[369] [[擬似クラス]] [CODE(CSS)@en[[[:target]]]] は、[[文書の示された部分]]が[[要素]]の場合、その[[要素]]と[[一致]]します
[SRC[>>146]]。
[FIG(corollary)[
[370] 「[[文書]]の先頭」が[[文書の示された部分]]の場合や[[文書の示された部分]]が存在しない場合には、
[CODE(CSS)@en[[[:target]]]] と[[一致]]するものはありません。
]FIG]
* 素片識別子構造
[240] [[素片識別子]]の意味や構文、処理方法の規定のことを[[素片識別子構造]]と呼びます
[SRC[>>297]]。[[素片識別子]]の共通の意味や構文、処理方法の他に、
適用対象の[[文書]]の [[MIME型]]などによって個別の規定があります。
[298] 具体的な[[素片識別子構造]]については、本項の以降の章や各
[[MIME型]]の項を参照してください。
[299] 特定の[[MIME型]]専用の[[素片識別子構造]]を発明するよりは、
できるだけ[[MIME型]]共通の[[素片識別子構造]]を共有する[['''べき''']]
[SRC[>>297]] とされています。
* 素片識別子の拡張
[8] 公式な URI の仕様の素片識別子には様々な問題点があり、
それを改善しようとする提案もいくつかあります。
しかし、公式に採用されたり、
広く受け入れられたりするに至ったものはまだありません。
[2] [[GNOME]] [ABBR[VFS] [仮想ファイル・システム]] URI とやら (''Writing Modules'' <http://developer.gnome.org/doc/API/gnome-vfs/writing-modules.html#URIS>) は、素片識別子 (のようなもの) を複数つけることができます。
(例: [SAMP(URI)[ftp://username:password@host.net/path/to/file.tar.gz#gzip#tar/path/to/hello.c]])
[28]
[[WinIE]] は [CODE(CSS)[[[behavior]]]] で [CODE(URI)[#]] が2つ入った文字列の指定を受け付けます。
ただし、素片識別子の拡張というよりはむしろ [Q[URI もどき]]です。
* 歴史
[20] '''主たる仕様''':
- [DEL@en[[[RFC 1630]] ([[URI]] 1[SUP[st]])]]
- [DEL@en[[[RFC 1738]] ([[URL]] 2[SUP[nd]])]]
- [DEL[[[RFC 1808]] ([[相対URL]])]]
- [DEL@en[[[RFC 2396]] ([[URI]] 3[SUP[rd]])]]
- [[RFC 3986]] ([[URI]] 4[SUP[th]])
- [[RFC 3987]] ([[IRI]])
- [WebArch] [CITE[Architecture of the World Wide Web, Volume One]]
-- [CSECTION[2.6. Fragment Identifiers]]
<http://www.w3.org/TR/webarch/#fragid>
-- [CSECTION[3.2.1. Representation types and fragment identifier semantics]]
<http://www.w3.org/TR/webarch/#media-type-fragid>
-- [CSECTION[3.2.2. Fragment identifiers and content negotiation]]
<http://www.w3.org/TR/webarch/#frag-coneg>
-- [CSECTION@en[4.5.8. Fragment identifiers in XML]]
<http://www.w3.org/TR/webarch/#xml-fragids>
- [[HTML 5]] ([[URL]])
[137] '''関連仕様''':
- [[ISO‐HTML]] <http://purl.org/NET/ISO+IEC.15445/15445.html#DEFS>
-- 4.9
** 定義
[1] '''ISO-HTML における定義''':
>
:[RUBYB[素片識別子] [Fragment identifier]]:
[CODE(HTMLa)[[[href]]]] 属性値の [CODE(URI)[#]]
に続く部分。[SRC[ISO‐HTML 4.9]]
[152] '''RELAX NG における定義''':
>
:3.6 fragment identifier:
additional information in a URI reference used by a user agent after the retrieval action on a URI has been
successfully performed
;; [[ISO/IEC 19757]]‐2:2003
** 生成規則 [CODE(ABNF)[fragment]]
[227] [[URI]] 系規格で構文規則 [DFN[[CODE(ABNF)[fragment]]]]
は、[[素片識別子]]を表しています。
[FIG[
= [228] [CODE(ABNF)[[DFN[fragmentid]] := [[xalphas]] ;; [[RFC 1630]]]]
= [229] [CODE(ABNF)[[DFN[fragment]] := *( [[uchar]] / [[reserved]] ) ;; [[RFC 1808]]]]
= [230] [CODE(ABNF)[[DFN[fragment]] := *[[uric]] ;; [[RFC 2396]] 4.1]]
]FIG]
* テストケース
[207] ([TIME[2011-09-11 03:41:55 +09:00]] 版) <http://people.mozilla.org/~dholbert/dataURIHashTests/tests_v1.xhtml>
* 関連
[16] [CODE(URI)[[[jar]]:]] [[URI scheme]] は、
[[ZIP]] 形式の圧縮ファイルの中のファイルを識別できます。
本来、[Q[ある資源の中に含まれる資源]]ですから、
素片識別子を使って表現するのが適当にも思えますが、
[CODE(URI)[jar:]] は[Q[資源の中の資源]]まで一つの
URI 本体だけで識別できます。
(この方式を推進する人は、[Q[ある資源の中の資源の中の資源]]
のような入れ子の場合を素片識別子は綺麗に表現できないことを問題視しています。)
同様な [[URI scheme]] は [CODE(URI)@en[[[zip]]:]], [CODE(URI)@en[[[tar]]:]],
[CODE(URI)@en[[[pack]]:]] など多数あります。
[32]
>>16 他に、素片識別子を使った表現の方法を採ると[[相対参照]]が使えなくなってしまう問題もあります。
[123]
[[CSS]] などで用いられる[[識別子選択子]]は本質的に[[素片識別子]]と同じものです。
[132]
[[HTML]] の [CODE(HTMLa)@en[[[usemap]]]] [[属性]]の値は元々 [[URI参照]]であるとされていましたが、諸々の事情により、
現在は [CODE(char)[#]] の後に参照する [CODE(HTMLe)@en[[[map]]]]
[[要素]]の [CODE(HTMLa)@en[[[name]]]]
[[属性]]の値を指定することになっています。
[151]
[[Webブラウザ]]で表示中の[[文書]]で[[ナビゲーション]]の結果[[素片識別子]]が変更された時に発生する
[[DOM]] [[事象]] [CODE(DOMe)@en[[[hashchange]]]] が [[HTML 5]]
で定義されています。
** 素片識別子だけを使うプロトコル要素
[17] [[SMIL]] の [CODE(XMLa)[[[fragment]]]] 属性は、
[[HTML]] の [CODE(HTMLa)[[[name]]]] 属性や [CODE(HTMLa)[[[id]]]]
属性や、 [[XML]]
の素片識別子を使ってある資源の一部を識別するために使うことができます。
[18] [[XInclude]] の [CODE(XMLa)[[[xpointer]]]] 属性は、
[[XPointer]] を使って XML の一部を識別するために使うことができます。
* 平名前素片識別子
[405] [[素片識別子]]の全体が[[文書]]中の構造の[[識別子]]であるような[[素片識別子]]を、
[[平名前素片識別子]]と呼ぶことがあります。
;; [[平名前素片識別子]]参照。
[EG[
[406] [[HTML]] では [CODE(HTMLa)@en[[[id]]] [[属性]]の値を[[素片識別子]]として指定することで、
その[[要素]]を示すことができます。
]EG]
[407] [[識別子]]のみで識別することができる構造がある [[MIME型]]では、
[[平名前素片識別子]]をその用途に使うよう定義する[['''べき''']] [SRC[>>391]]
と言われています。
[408] [[平名前素片識別子]]は最も基本的で古くからある[[素片識別子]]の形態で、
[[HTML]] や [[XML]] など多くの[[言語]]で広く採用されています。
** HTML の素片識別子
[REFS[
- [37] [CODE(HTMLa)[[[name]]]] 属性を参照
-- [CODE(MIME)[[[text/html]]]]: [[RFC 1866]]
--- [CODE(MIME)[[[text/x-hdml]]]]
---- [CITE[3 Language Elements]]
<http://www.w3.org/TR/hdml20-6.html#MARKER-9-4>
-- [7] [CODE(HTMLa)[[[name]]]] 属性や [CODE(HTMLa)[[[id]]]] 属性を参照
--- [CODE(MIME)[[[text/html]]]]:
---- [54] [[HTML 4]], [[XHTML 1.0]], [[RFC 2854]]
---- [55] [[ISO-HTML]]
<http://purl.org/NET/ISO+IEC.15445/Users-Guide.html#ANCHOR-FOLDING>
--- [100] [[XDML]] ([CODE(MIME)@en[[[application/xhtml+xml]]]])
---- [[DASE]]-2 5.1.1.5.1.1
- [198] [[ID]] や [CODE(HTMLa)@en[[[name]]]] [[属性]]を参照
-- [[HTML MIME型]] ([CODE(MIME)@en[[[text/html]]]], [CODE(MIME)@en[[[text/html-sandboxed]]]])
--- <http://www.whatwg.org/specs/web-apps/current-work/complete.html#the-indicated-part-of-the-document>
--- <http://www.whatwg.org/specs/web-apps/current-work/complete.html#text/html>
--- <http://www.whatwg.org/specs/web-apps/current-work/complete.html#text/html-sandboxed>
- [14] [CODE(XML)[[[ID]]]] 属性を参照
--- [47] [[XHTML 1.0]]
---- [[適合利用者エージェント]]は [[XHTML]]
[[文書]]の [CODE(XML)[[[ID]]]] 属性だけを[[素片識別子]]に使わなければなりません。
---- <IW:XHTML10:"uaconf">
---- [CSECTION[4.10. The elements with 'id' and 'name' attributes]]
(参考) <IW:XHTML10:"h-4.10">
---- [CSECTION[C.8. Fragment Identifiers]] (参考)
<IW:XHTML10:"C_8">
--- [48] [[XHTML m12n]]
---- [CSECTION[3.5. XHTML Family User Agent Conformance]]
<IW:XHTML1m12n:"conformance.html#s_conform_user_agent">
--- [34] [CODE(MIME)[[[application/xhtml+xml]]]]: [[RFC 3236]]
---- [[RFC 3023]] を参照しています。
---- しかし、 RFC 3023 は実質無規定なので、新版になるまでは
[CODE(XML)[[[ID]]]] 属性に拠ると規定しています。
--- [103] [[XHTML+Voice]] ([CODE(MIME)@en[[[application/xv+xml]]]])
---- [[RFC 4374]] <urn:ietf:rfc:4374>
---- [[RFC 3236]] を参照しています。
--- [108]
[CODE(MIME)@en[[[text/x-oeb1-document]]]]
---- 仕様書には明記なし。
]REFS]
[360] [CODE(MIME)@en[[[text/html]]]] では、[[文書の示された部分]]
(>>181) は次の方法で決定します [SRC[>>146]]。
[FIG(steps)[
= [361] [[URL]] を[[構文解析]]して、 [[素片識別子]]を得ます。
= [362] [[素片識別子]]が[[空文字列]]なら、[[文書]]の[RUBYB[先頭]@en[top]]を返して停止します。
= [363] [[素片識別子]]を[[パーセント復号]]し、[[UTF-8復号器]]を適用して[[復号エラー]]にならなければ、それと同じ [[ID]]
の[[要素]]があれば、そのうち[[木順]]で最初のものを返して停止します。
= [364] 元の[[素片識別子]]と同じ [CODE(HTMLa)@en[[[name]]]] [[属性値]]を持つ
[CODE(HTMLe)@en[[[a]]]] [[要素]]があれば、そのうち[[木順]]で最初のものを返して停止します。
= [365] 元の[[素片識別子]]が[[ASCII大文字・小文字不区別]]で [CODE[[[top]]]]
なら、[[文書]]の[RUBYB[先頭]@en[top]]を返して停止します。
= [366] 何も返さず停止します。
]FIG]
** 名前や識別子だけの素片識別子
[REFS[
- [315] [[XML]] [CODE(XML)@en[[[ID]]]] を使うもの
--- [36] [CITE[XBL - XML Binding Language]]
<http://www.w3.org/TR/2001/NOTE-xbl-20010223/#attach-css>
--- [73] [[SMIL]] ([CODE(MIME)@en[[[application/smil+xml]]]],
[CODE(MIME)@en[[[application/smil]]]])
---- [74]
[CITE@en[Synchronized Multimedia Integration Language]]
([[SMIL 1.0]]) <http://www.w3.org/TR/REC-smil/#hyperlinking>
---- [75] [CITE@en[The SMIL 2.0 Linking Modules]]
<http://www.w3.org/TR/2005/REC-SMIL2-20050107/extended-linking.html#SMILLinking-Into>
---- [76] [[RFC 4536]] <urn:ietf:rfc:4536>
----- [[SMIL]] 仕様書 (版指定なし) を参照。
--- [15] [CODE(MIME)[[[text/vnd.wap.wml]]]]
---- [CODE(XMLe)[[[deck]]]] 名を表します。
---- <http://www.openmobilealliance.org/release_program/docs/CopyrightClick.asp?pck=Browsing&file=V2_3-20050118-C/WAP-191-WML-20000219-a.pdf>
--- [[WML 2.0]] ([CODE(MIME)@en[[[application/wml+xml]]]])
---- [CODE(XMLa)@en[[[id]]]] を表します。
---- [CSECTION@en[5.3.1. The Go Task]] 他
---- [CSECTION@en[5.13. User Agent Conformance Rules]]
--- [60] [[XForms]]
---- [CITE@en[Document Structure]]
<http://www.w3.org/TR/2003/REC-xforms-20031014/slice3.html#structure-model>
----- [CODE(XMLe)[[[model]]]] 要素の [CODE(XMLa)[[[schema]]]]
属性で同じ文書内の [CODE(XML)[[[ID]]]] を参照できます。
--- [42] [CODE(MIME)[[[application/srgs+xml]]]] ([[SRGS]] [[XML]] 形)
---- [CODE(XMLe)[[[rule]]]] 名を表します。
---- [CITE[Speech Recognition Grammar Specification Version 1.0]]
<http://www.w3.org/TR/2004/REC-speech-grammar-20040316/#S2.2>
---- [DEL[以前媒体型登録のための [[I-D]] が出ていましたが、その後音沙汰なし。 (2005年3月現在) 素片識別子については [[RFC 3023]] と同じとか書いてありましたが・・・。]]
---- その後 [[RFC 4267]] で登録されました (>>83)。
--- [56] [[XTD]]
---- [CITE[tradic論理フォーマット]]
<http://www.tradic.jp/format_tradic_logical#reference>
---- [CITE[tradic物理フォーマット: XMLバインディング]]
<http://www.tradic.jp/format_tradic_xml>
]REFS]
[76] [[EMMA]] ([CODE(MIME)@en[[[application/emma+xml]]]])
は仕様書中に[[媒体型]]登録のための雛形がありますが、[[素片識別子]]については言及がありません。
仕様書中の例には[[同文書参照]]が頻出しますが、
同じ文書内の [CODE(XML)@en[xs:[[ID]]]] 型[[属性]]の値を使っているようです。
- [CITE[EMMA: Extensible MultiModal Annotation markup language]] ([[W3C]] [[勧告]])
-- <http://www.w3.org/TR/2009/REC-emma-20090210/>
--- [109] [[CellML]] ([CODE(MIME)@en[[[application/cellml+xml]]]])
---- [[媒体型]]を登録する [[RFC 4708]]
([[IETF]] [[情報提供]] [[RFC]]) <urn:ietf:rfc:4708>
に[[素片識別子]]への言及はありません。
---- [[CellML 1.0]]
<http://www.cellml.org/specifications/cellml_1.0/index_html#sec_metadata>
---- [[CellML 1.1]]
<http://www.cellml.org/specifications/cellml_1.1/index_html#sec_metadata>
---- 同じ[[文書]]内の [[RDF/XML]] から[[参照]]するために、
[[素片識別子]]として [CODE(XML)@en[[[ID]]]]
[[属性]]を使う方法が規定されています。
--- [110] [[WADL]]
([CODE(MIME)@en[[[application/vnd.sun.wadl+xml]]]])
---- 仕様書に例がありますが、明確な規定はありません。
---- [[IANA]] [[媒体型]]登録にも言及はありません。
--- [113] [[DSML]]
---- [CITE[Directory Services Markup Language (DSML)]]
<http://www.dsmltools.org/dsml.org/dsml.html>
---- 明確な規定はありませんが、頻用されています。
--- [120] [[VoiceXML 1.0]]
----
<http://www.voicexml.org/specs/VoiceXML-100.pdf#page=74>
----
[CITE[Voice eXtensible Markup Language (VoiceXML) version 1.0]] <http://www.w3.org/TR/2000/NOTE-voicexml-20000505/#s19.7>
--- [122] [[SCXML]]
---- [CITE@en[State Chart XML (SCXML): State Machine Notation for Control Abstraction]]
<http://www.w3.org/TR/2007/WD-scxml-20070221/#files>
--- [114] [[APEX]] ([CODE(MIME)@en[[[application/beep+xml]]]])
---- [[BEEP]] ([CODE(MIME)@en[[[application/beep+xml]]]])
を規定・登録する [[RFC 3080]] <urn:ietf:rfc:3080>
には、[[素片識別子]]への言及がありません。
---- [[BEEP]] の[[プロファイル]]たる [[APEX]] は、
同じ[[文書]]内の[[要素]]を[[参照]]するために[[素片識別子]]だけの
[[URI参照]]を使っています。
---- [[RFC 3340]] ([[IETF]] [[提案標準]]) <urn:ietf:rfc:3340>
4.1, 4.4.4
[153] [[KML]]
([CODE(MIME)@en[[[application/vnd.google-earth.kml+xml]]]],
[CODE(MIME)@en[[[application/vnd.google-earth.kmz]]]])
では[[要素]]の [CODE(XML)@en[xs:[[ID]]]] [[属性値]]を[[素片識別子]]に使えるようです。
;; [CITE[KML リファレンス]] ([TIME[2008-01-09 04:59:52 +09:00]] 版) <http://earth.google.co.jp/kml/kml_tags_21.html#styleurl>
正式な仕様書は [[KML]] (OGC 07-147r2) の [CSECTION@en[6.4 Shared Styles]]、
[CSECTION@en[9.1.3.10 kml:description]]、
[CSECTION@en[12.9.3.1 kml:href]]、他何箇所か。
12.9.3.1 は [[XPointer]] [[速記指示子]]を使って [[KML]] 内の[[要素]]を表せると述べています。
9.1.3.10 は [[escape]] された [[HTML]] 中のリンクについて触れていますが、
そこでは[[速記指示子]]になる前に指令部分を削ぎ落とさないといけないと規定しています。
;;いろいろややこしいな。
[REFS[
- [384] [[TTML]] ([CODE(MIME)@en[[[application/ttml+xml]]]])
-- [CITE@en-us[Timed Text Markup Language 1 (TTML1) (Second Edition)]] ([TIME[2013-09-23 10:19:57 +09:00]] 版) <http://www.w3.org/TR/ttaf1-dfxp/#media-types-registration>
-- [CODE(XMLa)@en[[[xml:id]]]] [[属性]]を参照します。
]REFS]
[433] [[XSLT 1.0]] は [CODE(XMLa)@en[[[id]]]] [[属性]]の用法として、
同じ[[文書]]の [CODE(XML)@en[[[xml-stylesheet]]]] から[[素片識別子]]によって参照できる
[SRC[>>432]] と示しています。ただし他の [[XML]] [[語彙]]の[[文書]]への埋め込み例であり単独の
[[MIME型]]での用法を示したものではありませんし、 [CODE(XMLa)@en[[[id]]]]
[[属性]]を使う際に [[DTD]] で [CODE(XML)@en[[[ID]]]] [[型]]と宣言しなければならないことにも言及があります。
[REFS[
- [432] [CITE[XSL Transformations (XSLT)]] ([TIME[2003-05-14 23:32:34 +09:00]] 版) <http://www.w3.org/TR/xslt#section-Embedding-Stylesheets>
]REFS]
** GML・SensorML
[156] [[GML]] では [CODE(XMLa)@en[gml:[[id]]]] [[属性]]を指すと規定されています。
[155] [[SensorML]] は、明確な規定はありませんが、
[CODE(XML)@en[[[ID]]]] [[属性]]を指しているようです。
[157] なお、 [[GML]] で [[XLink]] を使うときの[[素片識別子]]には制約があって、
[[速記]]、 [CODE(XPointerScheme)[[[element]]()]]、
[CODE(XPointerScheme)[[[xmlns]]()]] 0個以上 + [CODE(XPointerScheme)[[[xpointer]]()]]
のいずれかでなければなりません。
[255] [[国土数値情報]]は [[GML]] を埋め込んだ[[文書型]]を使っています。
[[XLink]] で同じ[[文書]]内の [[GML]] の[[要素]]を
[CODE(XMLa)@en[[[gml:id]]]] 値と[[速記]]により参照しています。
[REFS[
- [253] [[GML]]
-- [CSECTION@en[7.2.4.5 id]]
-- [CSECTION@en[8.1 Xlinks — Object associations and remote properties]]
- [254] [[SensorML]] <http://portal.opengeospatial.org/files/?artifact_id=21273>
]REFS]
** XTM
[154] [[XTM 1.0]] は、明確な規定はないのですが、 Note として、[[素片識別子]]だけの [[URI参照]]を
[CODE(XMLe)@en[[[topic]]]] [[要素]]の [CODE(XMLa)@en[[[id]]]] [[属性値]]を指しているものとして使っている旨の記述があります。
([[XTM 1.0]] では [[URI参照]] (に変換されるもの) は [[XLink 1.0]] [CODE(XMLa)@en[xlink:[[href]]]]
[[属性]]で使われています。)
- [CITE[XML Topic Maps (XTM) 1.0]] ([TIME[2005-10-25 23:11:49 +09:00]] 版)
--[CSECTION@en[2.1 A Gentle Introduction to Topic Maps]]
<http://www.topicmaps.org/xtm/1.0/xtm1-20010806.html#desc-intro>
** WS-EventDescriptions
[216] [[WS-EventDescriptions]] ([CODE(MIME)@en[[[application/evd+xml]]]])
では[RUBYB[[[事象記述文書]]]@en[Event Description document]]の[RUBYB[[[事象型]]]@en[Event Type]]を指します。
これは [CODE(XMLa)@en[[[id]]]] [[属性]] ([CODE(XML)@en[[[xs:ID]]]] 型) の値によって識別します。 [SRC[>>215]]
[REFS[
- [215] [CITE@en[Web Services Event Descriptions (WS-EventDescriptions)]] ([TIME[2011-12-13 20:09:52 +09:00]] 版) <http://www.w3.org/TR/2011/REC-ws-event-descriptions-20111213/#EVD_MIME>
]REFS]
** ALPS
[379] [[ALPS]] ([CODE(MIME)@en[[[application/alps+xml]]]], [CODE(MIME)@en[[[application/alps+json]]]]) では [CODE(XMLa)@en[[[id]]]]
[[属性値]]を参照しています [SRC[>>378]]。
[REFS[
- [378] [CITE@en[draft-amundsen-richardson-foster-alps-00 - Application-Level Profile Semantics (ALPS)]] ([TIME[2014-10-16 14:34:48 +09:00]] 版) <https://tools.ietf.org/html/draft-amundsen-richardson-foster-alps-00#section-2.2.7.2>
]REFS]
** 明記されていないが XML [CODE(XML)@en[ID]] を参照するらしいもの
-[CITE@en-US[Elements of an EmotionML 1.0]] ([TIME[2008-11-19 23:37:02 +09:00]] 版) <http://www.w3.org/2005/Incubator/emotion/XGR-emotionml-20081120/>
[REFS[
- [309] [[ITS]] ([CODE(MIME)@en[[[application/its+xml]]]])
-- [CITE@en-US[Internationalization Tag Set (ITS) Version 2.0]] ([TIME[2013-10-27 19:39:43 +09:00]] 版) <http://www.w3.org/TR/its20/>
]REFS]
[310] [CODE(XMLa)@en[[[xml:id]]]] を参照している例が何度も出てきます。
** その他の名前型素片識別子
- [43] [[N-Gram]]
-- [[開始記号]]を素片識別子で指定します。
-- [CITE[Stochastic Language Models (n-gram) Specification]]
<http://www.w3.org/TR/2001/WD-ngram-spec-20010103/>
-- [CITE[Speech Recognition Grammar Specification Version 1.0]]
<http://www.w3.org/TR/2004/REC-speech-grammar-20040316/#S2.2.4>
- [77] [[LTM]] ([[線形Topic Map記法]])
-- [[話題ID]] を使用します。
-- [CITE[The Linear Topic Map Notation]]
<http://www.ontopia.net/download/ltm.html#N870>
- [58] [[P3P]] <IW:P3P:"">
-- [CODE(XMLe)[[[POLICY]]]] [[要素]] [CODE(XMLa)[[[name]]]] [[属性]]
([CODE(XML)[[[ID]]]] 型):
[[素片識別子]]として使われます。
<IW:P3P:"#POLICY">
-- [CODE(XMLe)[[[POLICY-REF]]]] [[要素]] [CODE(XMLa)[[[about]]]]
[[属性]]で使う[[素片識別子]]: [CODE(XMLe)[[[POLICY]]]]
[[要素]]で [CODE(XMLa)[[[name]]]] [[属性]]が一致するものを指します。
<IW:P3P:"#ref_file_policyref">
-- [CODE(XMLe)[[[DATA]]]] [[要素]] [CODE(XMLa)[[[ref]]]]
[[属性]]で使う[[素片識別子]]:
[[データ要素]]や[[データ集合]]を指します。
[[要素型名]]を[[親]]から[[子]]に向かって [CODE(char)[.]]
で連結したものを使います。
<IW:P3P:"#DATA">
-- [CODE(XMLe)[[[DATA-STRUCT]]]], [CODE(XMLe)[[[DATA-DEF]]]] [[要素]]
[CODE(XMLa)[[[structref]]]] [[属性]]:
[[構造]]を指します。構造の名前 ([CODE(XMLa)[[[name]]]] [[属性]]
([CODE(XML)[[[ID]]]] 型) の
[CODE(char)[.]] で階層を区切った文字列) を使います。
指される方の定義が明示的に[[要素]]として存在するとは限りません。
[WEAK[(例えば [SAMP(URI)[#a]] が指すものは [SAMP[a.b]] や [SAMP[a.c]] などによって暗示的に定義され得ます。)]]
<IW:P3P:"#DATA-DEF-TYPE">
- [65] [[DITA]]
-- [CITE@en[OASIS Standards and Other Approved Work]]
<http://www.oasis-open.org/specs/index.php#ditav1.0>
-- [CITE@en[topic]] <http://docs.oasis-open.org/dita/v1.0/langspec/topic.html>
--- [CODE(XML)@en[[[ID]]]]
-- [CITE@en[xref]] <http://docs.oasis-open.org/dita/v1.0/langspec/xref.html>
--- [CODE(ABNF)[[CODE(XML)@en[[[ID]]]] "/" [CODE(XML)@en[[[ID]]]]]]
-- [CITE@en[link]] <http://docs.oasis-open.org/dita/v1.0/langspec/link.html>
--- [CODE(XML)@en[[[ID]]]]
-- [CITE@en[%id-atts;]]
<http://docs.oasis-open.org/dita/v1.0/langspec/id-atts.html>
--- [CODE(ABNF)[[CODE(XML)@en[[[ID]]]] "/" [CODE(XML)@en[[[ID]]]]]]
- [87] [[J#]] [[マネージ・ライブラリ]]
-- [[クラス名]]を[[素片識別子]]として使用
-- [CITE[Java アプレットから Microsoft J# ブラウザ コントロールへの移行]]
<http://www.microsoft.com/japan/msdn/vs/vj/vjtskMigratingJavaAppletsToMicrosoftJBrowserControls.asp>
- [67] [[X3D]] 系 ([[視点]]の名前を指定)
-- [66] [[VRML]] ([CODE(MIME)@en[[[model/vrml]]]])
--- <http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/nodesRef.html#Anchor>
--- <http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/nodesRef.html#Viewpoint>
-- [68] [[X3D]]
---
[CITE@en[Extensible 3D (X3D), ISO/IEC 19775-1:200x, Part 1 -- 23 Navigation component]]
<http://www.web3d.org/x3d/specifications/ISO-IEC-19775-IS-X3DAbstractSpecification/Part01/components/navigation.html#Viewpoint>
---
[CITE@en[Extensible 3D (X3D), ISO/IEC 19775-1:200x, Part 1 -- 9 Networking component]]
<http://www.web3d.org/x3d/specifications/ISO-IEC-19775-IS-X3DAbstractSpecification/Part01/components/networking.html#Anchor>
- [41] [CODE(MIME)[[[application/srgs]]]] ([[SRGS]] [[ABNF]] 形)
-- XML 形の [CODE(XML)[ID]] に相当する規則名を指します。
-- [CITE[Speech Recognition Grammar Specification Version 1.0]]
<http://www.w3.org/TR/2004/REC-speech-grammar-20040316/#S2.2>
-- [DEL[以前媒体型の IANA 登録のための [[I-D]] が出ていて、素片識別子は [[RFC 3023]] と同じなどと頓珍漢なことが書かれていました。登録手続きはその後音沙汰なし。 (2005年3月現在)]]
-- その後 [[RFC 4267]] で登録されましたが、
[[素片識別子]]に関する規定はなくなっています。
- [42] [[TTZ]] ([[T-Time]] 文書)
-- [[TTZ]] [[ファイル]]内の[[名前]]。
- [88] [[Texinfo]]
-- [[Texinfo]]系[CODE(URI)@en[[[info]]:]] [[URI]]で[[節点名]]が[[素片識別子]]として使われます。
- [89] [[HORB]] [[ACL]][[ファイル]]
-- [CODE(URI)@en[[[horb]]:]] [[URI]]で[[ACL]]名が[[素片識別子]]として使われます。
- [93] [CODE(URI)@en[[[irc]]:]] [[URI scheme]]
-- [[チャンネル名]]を[[素片識別子]]とする流儀があります。
- [94] [[名前空間]]に属する[[語彙]]
-- [CITE[XML Schema Part 2: Datatypes Second Edition]]
<http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#built-in-datatypes>
-- [CITE[Associating Resources with Namespaces]]
<http://www.w3.org/2001/tag/doc/nsDocuments-2005-12-13/#div.fragid>
[281] [[MathML]] の [CODE(XMLa)@en[[[definitionURL]]]] では[[素片識別子]]を含む [[URL]] の構文が決められています。
([[RDF]] などが想定されていますが、特定のデータ形式の[[素片識別子]]として定義されているわけではありません。)
[REFS[
- [280] [CITE[Mathematical Markup Language (MathML) Version 3.0 2nd Edition -- single page HTML + MathML Version]] ([TIME[2014-02-10 20:00:21 +09:00]] 版) <http://www.w3.org/Math/draft-spec/mathml.html#chapter4_contm.csymbol.extended>
]REFS]
** Git の素片識別子
[272] [[Git]] の[[フロントエンド]]である [[Cogito]] (旧 [[git-pasky]]) は [[Git]]
の[[リポジトリー]]の [[URL]] に[[素片識別子]]として[[ブランチ]]の名前を付加できました。
[REFS[
- [270] [CITE[cg-branch-add(1)]] ([TIME[2013-11-07 02:40:05 +09:00]] 版) <http://web.archive.org/web/20110612174908/http://www.kernel.org/pub/software/scm/cogito/docs/cg-branch-add.1.html>
- [271] [CITE[LKML: Petr Baudis: Re: ia64 git pull]] ([TIME[2011-09-08 00:16:43 +09:00]] 版) <https://lkml.org/lkml/2005/4/21/252>
]REFS]
[274] [[npm]] [SRC[>>273]] や [[Heroku]] ([[buildpack]] の指定 [SRC[>>374]])
も同様に[[素片識別子]]として[[コミット]]的なもの ([[SHA-1]] 値、[[ブランチ]]名等)
を指定できるとしています。
[REFS[
- [273] [CITE[npm-faq]] ([TIME[2013-10-28 21:09:47 +09:00]] 版) <https://npmjs.org/doc/faq.html#What-is-a-package>
- [374] [CITE@en[Buildpacks | Heroku Dev Center]] ([TIME[2014-10-02 02:37:18 +09:00]] 版) <https://devcenter.heroku.com/articles/buildpacks#using-a-custom-buildpack>
]REFS]
[381] [[Git]] 本家も同様の構文を使っています [SRC[>>380]]。
[REFS[
- [380] [CITE@en[Git - git-push Documentation]] ([TIME[2014-11-09 18:00:20 +09:00]] 版) <http://git-scm.com/docs/git-push#_named_file_in_code_git_dir_branches_code>
]REFS]
* XPointer に基づく素片識別子
[321] [[XPointer]] は [[XML]] の[[素片識別子]]の大本命とされていましたが、
開発が混乱し完全な形の実装もほとんどありません。元々は [[XML]]
の一部だった[[リンク]]機能が [[XLink]] として分離され、更に[[素片識別子]]機能が
[[XPointer]] として分離されましたが、 [[CR]] の後 [[XPath]] 相当の部分の開発は凍結され、
残りの基本的な部分のみ [[W3C勧告]]となりました。実際に広く実装されているといえるのは、
その内のさらに一部、 [CODE(XML)@en[[[ID]]]] による識別 ([[速記指示子]]) のみです。
;; 詳しくは [[XPointer]] の項を参照。
** RFC 3023 と分割前の XPointer
[322] [CODE(MIME)@en[[[text/xml]]]] と [CODE(MIME)@en[[[application/xml]]]]
をはじめに定義した [[RFC 2376]] は、[[素片識別子]]に関する規定を含んでいませんでした。
[6] [[RFC 2376]] の改訂である [[RFC 3023]] は、[[素片識別子]]の仕様として確立されたものはないと述べつつも、
[[XPointer]] [[WD]] が [CODE(MIME)@en[[[text/xml]]]] と [CODE(MIME)@en[[[application/xml]]]]
の[[素片識別子]]を規定していると言及しています [SRC[>>323]]。ここで参照されているのがどの版かは明記されていませんが、
2000年6月の [[CR]] (>>324) が記述と合致します。その次の2001年1月 [[LCWD]] (>>325) 以降は、
[CODE(MIME)@en[[[text/xml-external-parsed-entity]]]] と
[CODE(MIME)@en[[[application/xml-external-parsed-entity]]]] にも適用範囲が拡大されています。
;; [326] [CODE(MIME)@en[[[application/xml-dtd]]]] には言及がありません。
[REFS[
- [323] [CITE@en[RFC 3023 - XML Media Types]] ([TIME[2014-07-11 12:46:44 +09:00]] 版) <http://tools.ietf.org/html/rfc3023#section-5>