-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.bs
1900 lines (1491 loc) · 69.9 KB
/
index.bs
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
<pre class='metadata'>
Title: XML5 Standard
H1: XML5
Status: LS
Logo: https://resources.whatwg.org/logo.svg
Shortname: xml5
Level:1
Editor: Anne van Kesteren, Mozilla, < [email protected] >
Abstract: XML with well-defined error handling.
Editor: Daniel Fath, Unaffiliated, < [email protected] >
Group: WGORWHATEVER
</pre>
<style>
switch {
padding-left: 2em;
}
switch dt {
text-indent: -1.5em;
}
switch dt:before {
content: '\21AA';
padding: 0 0.5em 0 0;
display: inline-block;
}
.non-print {
background-color: #040404;
border-radius: 0.3em;
border-style: outset;
border-color: #546464;
font-family: Lucida Console, ui-monospace;
color: #e2e6e6;
}
code {
color: salmon;
}
table {
border-collapse: collapse;
border-style: hidden hidden none hidden;
}
table thead, table tbody {
border-bottom: solid;
}
table tbody th {
text-align: left;
}
table tbody th:first-child {
border-left: solid;
}
table td, table th {
border-left: solid;
border-right: solid;
border-bottom: solid thin;
vertical-align: top;
padding: 0.2em;
}
</style>
<h2 class="heading" data-level="1" id="parsing">
<span class="content">Parsing XML documents</span>
</h2>
This section and its subsection define the <dfn>XML parser</dfn>.
<p>This specification defines the parsing rules for XML documents, whether they are syntactically correct or not.
Certain points in the parsing algorithm are said to be <dfn lt="parse error">parse errors</dfn>. The handling for
parse errors is well-defined: user agents must either act as described below when encountering such problems, or
must terminate processing at the first error that they encounter for which they do not wish to apply the rules
described below.</p>
<h3 class="heading" data-level="1" id="parsing-overview">
<span class="content">Overview</span>
</h3>
The input to the XML parsing process consists of a stream of octets which is converted to a stream of code points, which in turn are tokenized, and finally those tokens are used to construct a tree.
<h3 class="heading" data-level="1" id="parse errors">
<span class="content">Parse Errors</span>
</h3>
This specification defines the parsing rules for XML5 documents, whether they are syntactically correct or not.
Certain points in the parsing algorithm are said to be parse errors.
The error handling for parse errors is well-defined (that's the processing rules described throughout this specification),
but user agents, while parsing an HTML document, may abort the parser at the first parse error that they encounter for
which they do not wish to apply the rules described in this specification.
<table class="parse-error-table">
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td><dfn>abrupt-closing-of-empty-comment</dfn></td>
<td>This error occurs if the parser encounters an empty comment that is abruptly closed by a U+003E
(<code>></code>) code
point (i.e., <code><!--></code> or <code><!---></code>). The parser behaves as if the comment is
closed correctly.
</td>
</tr>
<tr>
<td><dfn>abrupt-closing-xml-declaration</dfn></td>
<td>
This error occur if the parser encounters an unclosed quote in XML declaration. E.g. <code>
<?xml version="1?>
</code>
</td>
</tr>
<tr>
<td><dfn>colon-before-attr</dfn></td>
<td>This error occurs if the parser encounters a U+003A COLON (<code>:</code>) in tag after name but before
attribute name (e.g. <code><tag :attr</code>). Attributes can have namespaces but U+003A COLON but
namespaces can't be empty.
</td>
</tr>
<tr>
<td><dfn>eof-in-cdata</dfn></td>
<td>
This error occurs if the parser encounters the end of the input stream in a CDATA section.
The parser treats such CDATA sections as if they are closed immediately before the end of the input stream..
</td>
</tr>
<tr>
<td><dfn>eof-in-comment</dfn></td>
<td>
This error occurs if the parser encounters the end of the input stream in a comment.
The parser treats such comments as if they are closed immediately before the end of the input stream.
</td>
</tr>
<tr>
<td><dfn>eof-in-doctype</dfn></td>
<td>
This error occurs if the parser encounters the end of the input stream in a DOCTYPE section.
</td>
</tr>
<tr>
<td><dfn>eof-in-tag</dfn></td>
<td>
This error occurs if the parser encounters the end of the input stream in a start tag or an end tag
(e.g.,<code><div id=</code>). Such a tag is ignored.
</td>
</tr>
<tr>
<td><dfn>eof-in-xml-declaration</dfn></td>
<td>
This error occurs if the parser encounters the end of the input stream in a XML Declaration e.g. <code><?xml </code>
</td>
</tr>
<tr>
<td><dfn>incorrectly-opened-comment</dfn></td>
<td>This error occurs if the parser encounters the <code><!</code> code point sequence that is not
immediately
followed by two U+002D (<code>-</code>) code points and that is not the start of a DOCTYPE or a CDATA
section.
</tr>
<tr>
<td><dfn>invalid-xml-declaration</dfn></td>
<td>This error occurs if the parser encounters any code point sequence other than "<code>PUBLIC</code>"
and "<code>SYSTEM</code>" keywords after a DOCTYPE name. In such a case, the parser ignores any following
public or system identifiers
</td>
</tr>
<tr>
<td><dfn>missing-whitespace-before-doctype-name</dfn></td>
<td>This error occurs if the parser encounters a DOCTYPE keyword and name are not separated by ASCII whitespace.
(e.g. <code><!DOCTYPE</code>) In this case the parser behaves as if ASCII whitespace is present.
</td>
</tr>
<tr>
<td><dfn>missing-doctype-name</dfn></td>
<td>This error occurs if the parser encounters a DOCTYPE that is missing a name (e.g.,
<code><!DOCTYPE></code>).
</td>
</tr>
</tbody>
</table>
<h3 class="heading" data-level="1" id="input-stream">
<span class="content">Input stream</span>
</h3>
The stream of Unicode characters that consists the input to the tokenization stage will be initially seen by the user agent as a stream of octets (typically coming over the network or from the local file system). The octets encode Unicode code points according to a particular encoding, which the user agent must use to decode the octets into code points.
<p class="warning">Define how to find the encoding</p>
<p class="warning">Decide how to deal with null values</p>
<h3 class="heading" data-level="1" id="tokenization-overview">
<span class="content"><dfn>Tokenization</dfn></span>
</h3>
Implementations must act as if they used the following state machine to tokenise
HTML. The state machine must start in the data state. Most states consume a
single character, which may have various side-effects, and either switches the
state machine to a new state to reconsume the current input character, or
switches it to a new state to consume the next character, or stays in the same
state to consume the next character. Some states have more complicated behavior
and can consume several characters before switching to another state. In some
cases, the tokenizer state is also changed by the tree construction stage.
When a state says to <dfn>reconsume</dfn> a matched character in a specified state, that
means to switch to that state, but when it attempts to consume the next input
character, provide it with the current input character instead.
The <dfn>next input character</dfn> is the first character in the input stream that has
not yet been consumed or explicitly ignored by the requirements in this
section. Initially, the next input character is the first character in the
input. The <dfn>current input character</dfn> is the last character to have been consumed.
<p class="warning">Decide how to deal with namespaces</p>
<dl>
<h4 class="heading" id="data_state">
<span class="content"><dfn>Data state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0026 AMPERSAND (<code>&</code>)
<dd>Switch to <a>character reference in data state</a>.</dd>
<dt>U+003C LESSER-THAN SIGN (<code><</code>)</dt>
<dd>Switch to the <a>tag open state</a>.</dd>
<dt>EOF</dt>
<dd>Emit an end-of-file token.</dd>
<dt>Anything else</dt>
<dd>Emit the <a>current input character</a> as character. Stay in this state.</dd>
</dl>
</dd>
<h4 class="heading" id="charref_data_head">
<span class="content"><dfn>Character reference in data state</dfn></span>
</h4>
<dd>
Switch to the <a>data state</a>.
Attempt to <a>consume a character reference</a>.
If nothing is returned emit a U+0026 AMPERSAND character (<code>&</code>) token.
Otherwise, emit character tokens that were returned.
</dd>
<h4 class="heading" id="tag_open_state">
<span class="content"><dfn>Tag open state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+002F SOLIDUS (<code>/</code>)</dt>
<dd>Switch to the <a>end tag open state</a>.</dd>
<dt>U+003F QUESTION MARK(<code>?</code>)</dt>
<dd>Switch to the <a>pi state</a>.</dd>
<dt>U+0021 (<code>!</code>)</dt>
<dd>Switch to the <a>markup declaration state</a>.</dd>
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dt>U+003A (<code>:</code>)</dt>
<dt>U+003C LESSER-THAN SIGN (<code><</code>)</dt>
<dt>U+003E GREATER-THAN SIGN (<code>></code>)</dt>
<dt>EOF</dt>
<dd><a>Parse error</a>. Emit a U+003C LESSER-THAN SIGN (<code><</code>) character.
Reconsume the current input character in the <a>data state</a>.
</dd>
<dt>Anything else</dt>
<dd>Create a new tag token, then <a>reconsume</a> <a>current input character</a>
in <a>tag name state</a>.
</dd>
</dl>
</dd>
<h4 class="heading" id="end_tag_open_state">
<span class="content"><dfn>End tag open state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+003E GREATER-THAN SIGN (<code>></code>)</dt>
<dd>Emit a short end tag token and then switch to the <a>data
state</a>.
</dd>
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dt>U+003C LESSER-THAN SIGN (<code><</code>)</dt>
<dt>U+003A (<code>:</code>)</dt>
<dt>EOF</dt>
<dd><a>Parse error</a>. Emit a U+003C LESSER-THAN SIGN (<code><</code>) character
token and a U+002F SOLIDUS (<code>/</code>) character token. Reconsume the <a>current
input character</a> in the <a>data state</a>.
</dd>
<dt>Anything else</dt>
<dd>Create an end tag token, then reconsume the <a>current input character</a> in the <a>end tag name
state</a>.
</dd>
</dl>
</dd>
<h4 class="heading" id="end_stag_name_state">
<span class="content"><dfn>End tag name state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Switch to the <a>end tag name after state</a>.</dd>
<dt>U+002F SOLIDUS (<code>/</code>)</dt>
<dd><a>Parse error</a>. Switch to the <a>end tag name after state</a>.</dd>
<dt>EOF</dt>
<dd><a>Parse error</a>. Emit the start tag token and then reprocess the
current input character in the <a>data state</a>.
</dd>
<dt>U+003E GREATER-THAN SIGN (<code>></code>)</dt>
<dd>Emit the end tag token and then switch to the <a>data
state</a>.
</dd>
<dt>Anything else</dt>
<dd>Append the current input character to the tag name and stay in the
current state.
</dd>
</dl>
</dd>
<h4 class="heading" id="end_tag_name_after_state">
<span class="content"><dfn>End tag name after state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+003E GREATER-THAN SIGN (<code>></code>)</dt>
<dd>Emit the end tag token and then switch to the <a>data state</a>.</dd>
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Stay in the current state.</dd>
<dt>EOF</dt>
<dd><a>Parse error</a>. Emit the current token and then reprocess the
current input character in the <a>data state</a>.
</dd>
<dt>Anything else</dt>
<dd><a>Parse error</a>. Stay in the current state.</dd>
</dl>
</dd>
<h4 class="heading" id="tag_name_state">
<span class="content"><dfn>Tag name state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Switch to the <a>tag attribute name before state</a>.</dd>
<dt>U+003E GREATER-THAN SIGN (<code>></code>)</dt>
<dd>Emit the start tag token and then switch to the <a>data state</a>.</dd>
<dt>EOF</dt>
<dd>This an <a>eof-in-tag</a> <a>parse error</a>. Emit the current token and then reprocess the
current input character in the <a>data state</a>.
</dd>
<dt>U+002F SOLIDUS (<code>/</code>)</dt>
<dd>Set current tag to empty tag. Switch to the <a>empty tag state</a>.</dd>
<dt>Anything else</dt>
<dd>Append the current input character to the tag name and stay in the
current state.
</dd>
</dl>
</dd>
<h4 class="heading" id="empty_tag_state">
<span class="content"><dfn>Empty tag state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+003E GREATER-THAN SIGN (<code>></code>)</dt>
<dd>Emit the current tag token as empty tag token and then switch to the
<a>data state</a>.
</dd>
<dt>Anything else</dt>
<dd>Reconsume in <a>tag attribute value before state</a>.
</dd>
</dl>
</dd>
<h4 class="heading" id="tag_attr_name_before_state">
<span class="content"><dfn>Tag attribute name before state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Stay in the current state.</dd>
<dt>U+003E GREATER-THAN SIGN(<code>></code>)</dt>
<dd>Emit the current token and then switch to the <a>data state</a>.</dd>
<dt>U+002F SOLIDUS (<code>/</code>)</dt>
<dd>Set current tag to empty tag. Switch to the <a>empty tag state</a>.</dd>
<dt>U+003A COLON (<code>:</code>)</dt>
<dd>This is a <a>colon-before-attr</a> <a>parse error</a>. Stay in the current state.</dd>
<dt>EOF</dt>
<dd>This is an <a>eof-in-tag</a> <a>parse error</a>. Emit the current token and then reprocess the
current input character in the <a>data state</a>.
</dd>
<dt>Anything else</dt>
<dd>Start a new attribute in the current tag token. Set that attribute's
name to the current input character and its value to the empty string and
then switch to the <a>tag attribute name state</a>.
</dd>
</dl>
</dd>
<h4 class="heading" id="tag_attr_name_state">
<span class="content"><dfn>Tag attribute name state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+003D EQUALS SIGN (<code>=</code>)</dt>
<dd>Switch to the <a>tag attribute value before state</a>.</dd>
<dt>U+003E GREATER-THEN SIGN (<code>></code>)</dt>
<dd>Emit the current token as start tag token. Switch to the <a>data
state</a>.
</dd>
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Switch to the <a>tag attribute name after state</a>.</dd>
<dt>U+002F SOLIDUS (<code>/</code>)</dt>
<dd>Set current tag to empty tag. Switch to the <a>empty tag state</a>.</dd>
<dt>EOF</dt>
<dd>This is an <a>eof-in-tag</a> <a>parse error</a>. Emit the current token as start tag token and
then reprocess the current input character in the <a>data
state</a>.
</dd>
<dt>Anything else</dt>
<dd>Append the current input character to the current attribute's name.
Stay in the current state.
</dd>
</dl>
When the user agent leaves this state (and before emitting the tag token,
if appropriate), the complete attribute's name <em class="ct">must</em> be
compared to the other attributes on the same token; if there is already an
attribute on the token with the exact same name, then this is a parse error
and the new attribute <em class="ct">must</em> be dropped, along with the
value that gets associated with it (if any).
</dd>
<h4 class="heading" id="tag_attr_name_after_state">
<span class="content"><dfn>Tag attribute name after state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Stay in the current state.</dd>
<dt>U+003D EQUALS SIGN(<code>=</code>)</dt>
<dd>Switch to the <a>tag attribute value before state</a>.</dd>
<dt>U+003E GREATER-THEN SIGN(<code>></code>)</dt>
<dd>Emit the current token and then switch to the <a>data state</a>.</dd>
<dt>U+002F SOLIDUS (<code>/</code>)</dt>
<dd>Set current tag to empty tag. Switch to the <a>empty tag state</a>.</dd>
<dt>EOF</dt>
<dd>This is an <a>eof-in-tag</a> <a>parse error</a>. Emit the current token and then reprocess the
current input character in the <a>data state</a>.
</dd>
<dt>Anything else</dt>
<dd>Start a new attribute in the current tag token. Set that attribute's
name to the current input character and its value to the empty string and
then switch to the <a>tag attribute name state</a>.
</dd>
</dl>
</dd>
<h4 class="heading" id="tag_attr_value_before_state">
<span class="content"><dfn>Tag attribute value before state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Stay in the current state.</dd>
<dt>U+0022 QUOTATION MARK (<code>"</code>)</dt>
<dd>Switch to the <a>tag attribute value double quoted state</a>.</dd>
<dt>U+0027 APOSTROPHE (<code>'</code>)</dt>
<dd>Switch to the <a>tag attribute value single quoted state</a>.</dd>
<dt>U+0026 AMPERSAND (<code>&</code>):
<dd>Reprocess the input character in the <a>tag attribute value unquoted
state</a>.
</dd>
<dt>U+003E GREATER-THAN SIGN(<code>></code>)</dt>
<dd>Emit the current token and then switch to the <a>data state</a>.</dd>
<dt>EOF</dt>
<dd>This is an <a>eof-in-tag</a> <a>parse error</a>. Emit the current token and then reprocess the
current input character in the <a>data state</a>.
</dd>
<dt>Anything else</dt>
<dd>Append the current input character to the current attribute's value and
then switch to the <a>tag attribute value unquoted state</a>.
</dd>
</dl>
</dd>
<h4 class="heading" id="tag_attr_value_double_quote_state">
<span class="content"><dfn>Tag attribute value double quoted state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0022 QUOTATION MARK (<code>"</code>)</dt>
<dd>Switch to the <a>tag attribute name before state</a>.</dd>
<dt>U+0026 AMPERSAND (<code>&</code>)</dt>
<dd>Switch to <a>character reference in attribute value state</a>, with the
<a>additional allowed character</a> being U+0022 QUOTATION MARK(<code>"</code>).
</dd>
<dt>EOF</dt>
<dd>This is an <a>eof-in-tag</a> <a>parse error</a>. Emit the current token and then reprocess the
current input character in the <a>data state</a>.
</dd>
<dt>Anything else</dt>
<dd>Append the input character to the current attribute's value. Stay in
the current state.
</dd>
</dl>
</dd>
<h4 class="heading" id="tag_attr_value_single_quote_state">
<span class="content"><dfn>Tag attribute value single quoted state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0022 QUOTATION MARK (<code>'</code>)</dt>
<dd>Switch to the <a>tag attribute name before state</a>.</dd>
<dt>U+0026 AMPERSAND (<code>&</code>)</dt>
<dd>Switch to <a>character reference in attribute value state</a>, with the
<a>additional allowed character</a> being APOSTROPHE (<code>'</code>).
</dd>
<dt>EOF</dt>
<dd>This is an <a>eof-in-tag</a> <a>parse error</a>. Emit the current token and then reprocess the
current input character in the <a>data state</a>.
</dd>
<dt>Anything else</dt>
<dd>Append the input character to the current attribute's value. Stay in
the current state.
</dd>
</dl>
</dd>
<h4 class="heading" id="tag_attr_value_unquote_state">
<span class="content"><dfn>Tag attribute value unquoted state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Switch to the <a>tag attribute name before state</a>.</dd>
<dt>U+0026 AMPERSAND (<code>&</code>):
<dd>
Switch to <a>character reference in attribute value state</a>, with the
<a>additional allowed character</a> being U+003E GREATER-THAN SIGN(<code>></code>).
</dd>
<dt>U+003E GREATER-THAN SIGN (<code>></code>)</dt>
<dd>Emit the current token as start tag token and then switch to the
<a>data state</a>.
</dd>
<dt>EOF</dt>
<dd>This is an <a>eof-in-tag</a> <a>parse error</a>. Emit the current token as start tag token and
then reprocess the current input character in the
<a>data state</a>.
</dd>
<dt>Anything else</dt>
<dd>Append the input character to the current attribute's value. Stay in
the current state.
</dd>
</dl>
</dd>
<h4 class="heading" id="pi_state">
<span class="content"><dfn>Pi state</dfn></span>
</h4>
<dd>
If the next few characters are:
<dl class="switch">
<dt>Exact match for word "xml".</dt>
<dd>
Consume those characters and switch to <a>xml declaration state</a>
</dd>
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dt>EOF</dt>
<dd><a>Parse error</a>. <a>Reconsume</a> current input characters in the
<a>bogus comment state</a>.
</dd>
<dt>Anything else</dt>
<dd>Create a new processing instruction token. <a>Reconsume</a> current characters in <a>pi
target state</a>.
</dd>
</dl>
</dd>
<h4 class="heading" id="xml_declaration_state">
<span class="content"><dfn>XML declaration state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Stay in current state</dd>
<dt>U+0076 LATIN SMALL LETTER V (<code>v</code>)</dt>
<dt>U+0065 LATIN SMALL LETTER E (<code>E</code>)</dt>
<dt>U+0073 LATIN SMALL LETTER S (<code>S</code>)</dt>
<dd>Reconsume current character in <a>XML declaration attribute name state</a></dd>
<dt>
U+003F QUESTION MARK (<code>?</code>)
</dt>
<dd>Switch to <a>XML Declaration after state</a>.</dd>
<dt>EOF</dt>
<dd>This is a <a>eof-in-xml-declaration</a> <a>parse error</a>. Append string "xml"
to the processing instruction target, emit current processing instruction token and emit end-of-file
token.
</dd>
<dt>Anything else</dt>
<dd>This is an <a>invalid-xml-declaration</a> <a>parse error</a>. Append string "xml"
to the processing instruction target, then reconsume current character in <a>pi data state</a></dd>
</dl>
</dd>
<h4 class="heading" id="xml_declaration_attr_name_state">
<span class="content"><dfn>XML declaration attribute name state</dfn></span>
</h4>
<dd>
If the next few characters are:
<dl class="switch">
<dt>Exact match for word "version".</dt>
<dd>
Set current xml declaration attribute name to version. Switch to <a>XML declaration attribute name
after</a>.
</dd>
<dt>Exact match for word "encoding".</dt>
<dd>
Set current xml declaration attribute name to encoding. Switch to <a>XML declaration attribute name
after</a>.
</dd>
<dt>Exact match for word "standalone".</dt>
<dd>
Set current xml declaration attribute name to standalone. Switch to <a>XML declaration attribute name
after</a>.
</dd>
<dt>Anything else</dt>
<dd>This is an <a>invalid-xml-declaration</a> <a>parse error</a>. Switch to <a>pi target state</a></dd>
</dl>
</dd>
<h4 class="heading" id="xml_declaration_attr_name_after_state">
<span class="content"><dfn>XML declaration attribute name after</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Stay in current state.</dd>
<dt>U+003D EQUALS SIGN (<code>=</code>)</dt>
<dd>Switch to <a>XML declaration attribute before value state</a>.</dd>
<dt>EOF</dt>
<dd>This is an <a>eof-in-xml-declaration</a> <a>parse error</a>. Push to processing instruction target
<code>xml</code>, then push to processing instruction data <code>version=</code>.
Emit processing instruction token.
</dd>
<dt>Anything else</dt>
<dd>This is an <a>invalid-xml-declaration</a> <a>parse error</a>. Push to processing instruction target
<code>xml</code>, then push to processing instruction data <code>version=</code>.
Reconsume in <a>pi target state</a>.
</dd>
</dd>
</dl>
</dd>
<h4 class="heading" id="xml_declaration_attribute_before_value_state">
<span class="content"><dfn>XML declaration attribute before value state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Stay in current state.</dd>
<dt>U+0027 APOSTROPHE (<code>'</code>)</dt>
<dd>Switch to <a>XML declaration attribute value (single-quoted) state</a>.</dd>
<dt>U+0022 QUOTATION MARK (<code>"</code>)</dt>
<dd>Switch to <a>XML declaration attribute value (double-quoted) state</a>.</dd>
<dt>EOF</dt>
<dd>This is an <a>eof-in-xml-declaration</a> <a>parse error</a>. Push to processing instruction target
<code>xml</code>, then push to processing instruction data <code>version=</code>.
Emit processing instruction token.
</dd>
<dt>Anything else</dt>
<dd>This is an <a>invalid-xml-declaration</a> <a>parse error</a>. Push to processing instruction target
<code>xml</code>, then push to processing instruction data <code>version=</code>.
Reconsume in <a>pi target state</a>.
</dd>
</dd>
</dl>
</dd>
<h4 class="heading" id="xml_declaration_attribute_value_single_quoted_state">
<span class="content"><dfn>XML declaration attribute value (single-quoted) state</dfn></span>
</h4>
<dd>
If the next few characters are:
<dl class="switch">
<dt>U+0027 APOSTROPHE (<code>'</code>)</dt>
<dd>Switch to <a>XML declaration state</a>.</dd>
<dt>U+003F QUESTION MARK (<code>?</code>)</dt>
<dd>This is an <a>abrupt-closing-xml-declaration</a> <a>parse error</a>.
Switch to <a>XML Declaration after state</a>.
</dd>
<dt>EOF</dt>
<dd>This is an <a>eof-in-xml-declaration</a> <a>parse error</a>. Emit current xml declaration.
Emit end-of-file token.
</dd>
<dt>Anything else</dt>
<dd>This is an <a>invalid-xml-declaration</a> <a>parse error</a>. Switch to <a>pi target state</a>
</dd>
</dl>
</dd>
<h4 class="heading" id="xml_declaration_attribute_value_double_quoted_state">
<span class="content"><dfn>XML declaration attribute value (double-quoted) state</dfn></span>
</h4>
<dd>
If the next few characters are:
<dl class="switch">
<dt>U+0022 QUOTATION MARK (<code>"</code>)</dt>
<dd>Switch to <a>XML declaration state</a>.</dd>
<dt>U+003F QUESTION MARK (<code>?</code>)</dt>
<dd>This is an <a>abrupt-closing-xml-declaration</a> <a>parse error</a>.
Switch to <a>XML Declaration after state</a>.
</dd>
<dt>EOF</dt>
<dd>This is an <a>eof-in-xml-declaration</a> <a>parse error</a>. Emit current xml declaration.
Emit end-of-file token.
</dd>
<dt>Anything else</dt>
<dd>This is an <a>invalid-xml-declaration</a> <a>parse error</a>. Switch to <a>pi target state</a>
</dd>
</dl>
</dd>
<h4 class="heading" id="xml_decl_after">
<span class="content"><dfn>XML declaration after state</dfn></span>
</h4>
<dd>
If the next few characters are:
<dl class="switch">
<dt>U+003E GREATER-THAN SIGN (<code>></code>)</dt>
<dd>Emit the xml declaration token and then switch to the <a>data state</a>.</dd>
<dt>U+003F QUESTION MARK(<code>?</code>)</dt>
<dd>Append the current input character to the PI's data and stay in the
current state.
</dd>
<dt>Anything else</dt>
<dd>Reprocess the current input character in the <a>pi data
state</a>.
</dd>
</dl>
</dd>
<h4 class="heading" id="pi_target_state">
<span class="content"><dfn>Pi target state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Switch to the <a>pi target after state</a>.</dd>
<dt>EOF</dt>
<dd><a>Parse error</a>. Emit the current processing instruction token and then reprocess the
current input character in the <a>data state</a>.
</dd>
<dt>U+003F QUESTION MARK(<code>?</code>)</dt>
<dd>Switch to the <a>pi after state</a>.</dd>
<dt>Anything else</dt>
<dd>Append the current input character to the processing instruction target and stay in the
current state.
</dd>
</dl>
</dd>
<h4 class="heading" id="pi_target_after_state">
<span class="content"><dfn>Pi target after state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+0009 CHARACTER TABULATION (<code class="non-print">Tab</code>)</dt>
<dt>U+000A LINE FEED (<code class="non-print">LF</code>)</dt>
<dt>U+0020 SPACE (<code class="non-print">Space</code>)</dt>
<dd>Stay in the current state.</dd>
<dt>Anything else</dt>
<dd>Reprocess the current input character in the <a>pi data
state</a>.
</dd>
</dl>
</dd>
<h4 class="heading" id="pi_data_state">
<span class="content"><dfn>Pi data state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+003F QUESTION MARK(<code>?</code>)</dt>
<dd>Switch to the <a>pi after state</a>.</dd>
<dt>EOF</dt>
<dd>This is a <a>eof-in-cdata</a> <a>parse error</a>. Emit the current processing instruction token
and then
reprocess the
current input character in the <a>data state</a>.
</dd>
<dt>Anything else</dt>
<dd>Append the current input character to the pi's data and stay in the
current state.
</dd>
</dl>
</dd>
<h4 class="heading" id="pi_after_state">
<span class="content"><dfn>Pi after state</dfn></span>
</h4>
<dd>
Consume the <a>next input character</a>:
<dl class="switch">
<dt>U+003E GREATER-THAN SIGN (<code>></code>)</dt>