/[suikacvs]/markup/html/html5/spec-ja/data/parsing.dat
Suika

Contents of /markup/html/html5/spec-ja/data/parsing.dat

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.71 - (show annotations) (download)
Sat Oct 25 08:57:11 2008 UTC (17 years, 9 months ago) by apache
Branch: MAIN
CVS Tags: HEAD
Changes since 1.70: +21 -1 lines
by remote user 'guest'

1 #pattern
2 <span class=secno>* </span>Parsing HTML documents
3 #ja
4 <span class=secno>$1 </span>HTML 文書の構文解析
5
6 #en
7 <em>This section only applies to user agents, data mining tools, and
8 conformance checkers.</em>
9 #ja
10 <em>この節は利用者エージェント、データ・マイニング・ツール、
11 適合性検査器のみに適用されます。</em>
12
13 #en
14 The rules for parsing <a href=#xml-documents>XML documents</a> (and
15 thus <a href=#xhtml5>XHTML</a> documents) into DOM trees are covered by
16 the XML and Namespaces in XML specifications, and are out of scope of this
17 specification. <a href=#refsXML>[XML]</a> <a
18 href=#refsXMLNS>[XMLNS]</a> <!-- XXX refs -->
19 #ja
20 <a href=#xml-documents>XML 文書</a> (や <a href=#xhtml5>XHTML</a> 文書)
21 を構文解析して DOM 木を得るための規則は XML や XML 名前空間の仕様書で扱われており、
22 この仕様書の適用範囲外です。 <a href=#refsXML>[XML]</a> <a
23
24 #en
25 For <a href=#html-documents>HTML documents</a>, user agents must use the
26 parsing rules described in this section to generate the DOM trees.
27 Together, these rules define what is referred to as the <dfn
28 id=html-parser>HTML parser</dfn>.
29 #ja
30 <a href=#html-documents>HTML 文書</a>については、利用者エージェントは、 DOM
31 木を生成するためにこの節で説明する構文解析規則を使用しなければ[[MUST:なりません]]。
32 また、この規則は<dfn
33 id=html-parser>HTML 構文解析器</dfn>と呼ばれるものを定義します。
34
35 #en
36 While the HTML form of HTML5 bears a close resemblance to SGML and XML,
37 it is a separate language with its own parsing rules.
38 #ja
39 HTML5 の HTML 形式は SGML や XML によく似ていますが、
40 独自の構文解析規則を持つ別の言語です。
41
42 #en
43 Some earlier versions of HTML (in particular from HTML2 to HTML4) were
44 based on SGML and used SGML parsing rules. However, few (if any) web
45 browsers ever implemented true SGML parsing for HTML documents; the only
46 user agents to strictly handle HTML as an SGML application have
47 historically been validators. The resulting confusion &mdash; with
48 validators claiming documents to have one representation while widely
49 deployed Web browsers interoperably implemented a different
50 representation &mdash; has wasted decades of productivity. This version
51 of HTML thus returns to a non-SGML basis.
52 #ja
53 以前のいくつかの版の HTML (特に HTML2 から HTML4 まで) は SGML
54 に基づき、 SGML の構文解析規則を用いていました。しかし、 HTML
55 文書用に真の SGML 構文解析を実装していたウェブ・ブラウザは (あったとしても)
56 皆無に近い数でした。 HTML を厳密に SGML 応用として扱う唯一の利用者エージェントは歴史的に妥当性検証器だけでした。
57 その結果、妥当性検査器は文書がある形式であることを要求し、
58 一方で広く実用されている Web ブラウザはそれとは異なる形式を相互運用可能な形で実装するという混乱が生じ、
59 生産性を大きく低下させています。
60 ですので、この版の HTML は非 SGML ベースに回帰します。
61
62 #en
63 Authors interested in using SGML tools in their authoring pipeline are
64 encouraged to use XML tools and the XML serialization of HTML5.
65 #ja
66 文書準備の過程で SGML ツールを使いたいと考える著者には、
67 XML ツールと HTML5 の XML 直列化を用いることをお勧めします。
68
69 #en
70 This specification defines the parsing rules for HTML documents, whether
71 they are syntactically correct or not. Certain points in the parsing
72 algorithm are said to be <dfn id=parse-a-date-string title="parse error">parse
73 errors</dfn>. The error handling for parse errors is well-defined: user
74 agents must either act as described below when encountering such problems,
75 or must abort processing at the first error that they encounter for which
76 they do not wish to apply the rules described below.
77 #ja
78 この仕様書は、構文的に正しいか否かに関わらず HTML
79 文書を構文解析する規則を定義します。構文解析算法中のいくつかの箇所は<dfn id=parse-a-date-string title="parse error">構文解析誤り</dfn>であるとしています。
80 構文解析誤りの処理は明確に定義します。利用者エージェントは、
81 そのような問題に遭遇したときに後述のように動作するか、または後述の規則を適用することを望まないような誤りにはじめて遭遇した箇所で処理を停止しなければ[[MUST:なりません]]。
82
83 #en
84 Conformance checkers must report at least one parse error condition to
85 the user if one or more parse error conditions exist in the document and
86 must not report parse error conditions if none exist in the document.
87 Conformance checkers may report more than one parse error condition if
88 more than one parse error conditions exist in the document. Conformance
89 checkers are not required to recover from parse errors.
90 #ja
91 適合性検査器は、文書中に1つ以上の構文解析誤り条件が存在する場合、利用者に最低1つの構文解析誤り条件を報告しなければ[[MUST:ならず]]、
92 文書に誤りが存在しない場合、構文解析誤り条件を報告しては[[MUST NOT:なりません]]。
93 適合性検査器は、文書中に複数の構文解析誤り条件が存在する場合、
94 複数の構文解析誤り条件を報告して[[MAY:構いません]]。
95 適合性検査器は構文解析誤りから回復することを[[REQUIRED:要求]]されません。
96
97 #en
98 Parse errors are only errors with the <em>syntax</em> of
99 HTML. In addition to checking for parse errors, conformance checkers will
100 also verify that the document obeys all the other conformance requirements
101 described in this specification.
102 #ja
103 構文解析誤りは、 HTML の<em>構文</em>の誤りに過ぎません。
104 適合性検査器は、構文解析誤りの検査に加え、
105 文書がこの仕様書で説明されている他の適合性要件に従っているかも検査することになります。
106
107
108 #pattern
109 <span class=secno>* </span>The scripting state
110 #ja
111 <span class=secno>$1 </span>スクリプティング状態
112
113 #en
114 The <dfn id=scripting-is-disabled>scripting flag</dfn> is set to "enabled" if the
115 <code>Document</code> with which the parser is associated was <a
116 href=#with-script>with script</a> when the parser was created, and
117 "disabled" otherwise.
118 #ja
119 <dfn id=scripting-is-disabled>スクリプティング旗</dfn>は、構文解析器が関連付けられている
120 <code>Document</code> が構文解析器の作成の時点で<a
121 href=#with-script>スクリプト付き</a>である場合には「有効」、
122 それ以外の場合には「無効」です。
123
124 #pattern
125 <span class=secno>* </span><dfn
126 >Tokenization</dfn>
127 #ja
128 <span class=secno>$1 </span><dfn
129 >字句化</dfn>
130
131 #en
132 Implementations must act as if they used the following state machine to
133 tokenise HTML. The state machine must start in the <a
134 href=#data-state>data state</a>. Most states consume a single character,
135 which may have various side-effects, and either switches the state machine
136 to a new state to <em>reconsume</em> the same character, or switches it to
137 a new state (to consume the next character), or repeats the same state (to
138 consume the next character). Some states have more complicated behavior
139 and can consume several characters before switching to another state.
140 #ja
141 実装は、次の状態機械を HTML の字句化に用いているかのように作用しなければ[[MUST:なりません]]。
142 状態機械は、<a
143 href=#data-state>データ状態</a>で開始しなければ[[MUST:なりません]]。
144 ほとんどの状態は1文字消費しますが、
145 この時様々な副作用を持っても[[MAY:構わない]]他、
146 状態機械が新しい状態に切り替えられて同じ文字を<em>再消費</em>するか、
147 (次の文字を消費するために) 新しい状態に切り替えられるか、
148 (次の文字を消費するために) 同じ状態を繰り返すかのいずれかとなります。
149 より複雑な動作を持っていて、他の状態に切り替える前に複数の文字を消費することがある状態もあります。
150
151 #en
152 The exact behavior of certain states depends on a <dfn
153 id=attr-meta-http-equiv-content-language>content model flag</dfn> that is set after certain tokens are
154 emitted. The flag has several states: <em title="">PCDATA</em>, <em
155 title="">RCDATA</em>, <em title="">CDATA</em>, and <em
156 title="">PLAINTEXT</em>. Initially it must be in the PCDATA state. In the
157 RCDATA and CDATA states, a further <dfn id=escape-flag>escape flag</dfn> is
158 used to control the behavior of the tokeniser. It is either true or false,
159 and initially must be set to the false state. The <span>insertion
160 mode</span> and the <a href=#stack-of-open-elements>stack of open elements</a> also
161 affects tokenization.
162 #ja
163 特定の状態の正確な動作は、特定の字句が放出された後に設定される<dfn
164 id=attr-meta-http-equiv-content-language>内容モデル旗</dfn>に依存します。
165 この旗は状態 <em title="">PCDATA</em>, <em
166 title="">RCDATA</em>, <em title="">CDATA</em>, <em
167 title="">PLAINTEXT</em> を持ちます。はじめは PCDATA
168 状態でなければ[[MUST:なりません]]。 RCDATA 状態と CDATA 状態では、
169 更に<dfn id=escape-flag>逃避旗</dfn>が字句化器の動作を制御するために用いられます。
170 これは真か偽かのいずれかであり、はじめは偽の状態に設定されなければ[[MUST:なりません]]。
171 挿入モードと<a href=#stack-of-open-elements>開いているようそのスタック</a>も字句化器に影響します。
172
173 #en
174 The output of the tokenization step is a series of zero or more of the
175 following tokens: DOCTYPE, start tag, end tag, comment, character,
176 end-of-file. DOCTYPE tokens have a name, a public identifier, a system
177 identifier, and a <i>force-quirks flag</i>. When a DOCTYPE token is
178 created, its name, public identifier, and system identifier must be marked
179 as missing (which is a distinct state from the empty string), and the
180 <i>force-quirks flag</i> must be set to <i>off</i> (its other state is
181 <i>on</i>). Start and end tag tokens have a tag name, a <i>self-closing
182 flag</i>, and a list of attributes, each of which has a name and a value.
183 When a start or end tag token is created, its <i>self-closing flag</i>
184
185 must be unset (its other state is that it be set), and its attributes list
186 must be empty. Comment and character tokens have data.
187 #ja
188 字句化期の出力は、 DOCTYPE、開始タグ、終了タグ、注釈、文字、ファイル末のいずれかの字句の零個以上の系列です。
189 DOCTYPE 字句は名前、公開識別子、システム識別子、<i>奇癖強制旗</i>を持ちます。
190 When a DOCTYPE token is
191 created, its name, public identifier, and system identifier must be marked
192 as missing (which is a distinct state from the empty string), and the
193 <i>force-quirks flag</i> must be set to <i>off</i> (its other state is
194 <i>on</i>). Start and end tag tokens have a tag name, a <i>self-closing
195 flag</i>, and a list of attributes, each of which has a name and a value.
196 When a start or end tag token is created, its <i>self-closing flag</i>
197
198 must be unset (its other state is that it be set), and its attributes list
199 must be empty. Comment and character tokens have data.
200
201
202
203
204
205 #pattern
206 <span class=secno>* </span>Parse state
207 #ja
208 <span class=secno>$1 </span>構文解析状態
209
210 #pattern
211 <span class=secno>* </span>The insertion mode
212 #ja
213 <span class=secno>$1 </span>挿入モード
214
215 #en
216 Initially the <span>insertion mode</span> is "<a href=#the-initial-insertion-mode
217 title="insertion mode: initial">initial</a>". It can change to "<a
218 href=#before-attribute-name-state title="insertion mode: before html">before html</a>", "<a
219 href=#before-attribute-value-state title="insertion mode: before head">before head</a>", "<a
220 href=#parsing-main-inhead title="insertion mode: in head">in head</a>", "<a
221 href=#parsing-main-inheadnoscript title="insertion mode: in head noscript">in head
222 noscript</a>", "<a href=#after-attribute-name-state title="insertion mode: after head">after
223 head</a>", "<a href=#parsing-main-inbody title="insertion mode: in body">in
224 body</a>", "<a href=#parsing-main-intable title="insertion mode: in table">in
225 table</a>", "<a href=#parsing-main-incaption title="insertion mode: in caption">in
226 caption</a>", "<a href=#parsing-main-incolgroup title="insertion mode: in column
227 group">in column group</a>", "<a href=#parsing-main-intbody title="insertion mode:
228 in table body">in table body</a>", "<a href=#parsing-main-intr title="insertion
229 mode: in row">in row</a>", "<a href=#parsing-main-intd title="insertion mode: in
230 cell">in cell</a>", "<a href=#parsing-main-inselect title="insertion mode: in
231 select">in select</a>", "<a href=#parsing-main-inselectintable title="insertion mode: in
232 select in table">in select in table</a>", "<a href=#parsing-main-inforeign
233 title="insertion mode: in foreign content">in foreign content</a>", "<a
234 href=#after-attribute-value-(quoted)-state title="insertion mode: after body">after body</a>", "<a
235 href=#parsing-main-inframeset title="insertion mode: in frameset">in frameset</a>",
236 "<a href=#after-doctype-name-state title="insertion mode: after frameset">after
237 frameset</a>", "<a href=#after-doctype-public-identifier-state title="insertion mode: after after
238 body">after after body</a>", and "<a href=#after-doctype-system-identifier-state title="insertion mode:
239 after after frameset">after after frameset</a>" during the course of the
240 parsing, as described in the <a href=#tree-construction>tree
241 construction</a> stage. The insertion mode affects how tokens are
242 processed and whether CDATA blocks are supported.
243 #ja
244 はじめ、<span>挿入モード</span>は "<a href=#the-initial-insertion-mode
245 title="insertion mode: initial">initial</a>" です。挿入モードは、
246 構文解析の過程で、<a href=#tree-construction>木構築</a>期で説明するように、
247 "<a
248 href=#before-attribute-name-state title="insertion mode: before html">before html</a>", "<a
249 href=#before-attribute-value-state title="insertion mode: before head">before head</a>", "<a
250 href=#parsing-main-inhead title="insertion mode: in head">in head</a>", "<a
251 href=#parsing-main-inheadnoscript title="insertion mode: in head noscript">in head
252 noscript</a>", "<a href=#after-attribute-name-state title="insertion mode: after head">after
253 head</a>", "<a href=#parsing-main-inbody title="insertion mode: in body">in
254 body</a>", "<a href=#parsing-main-intable title="insertion mode: in table">in
255 table</a>", "<a href=#parsing-main-incaption title="insertion mode: in caption">in
256 caption</a>", "<a href=#parsing-main-incolgroup title="insertion mode: in column
257 group">in column group</a>", "<a href=#parsing-main-intbody title="insertion mode:
258 in table body">in table body</a>", "<a href=#parsing-main-intr title="insertion
259 mode: in row">in row</a>", "<a href=#parsing-main-intd title="insertion mode: in
260 cell">in cell</a>", "<a href=#parsing-main-inselect title="insertion mode: in
261 select">in select</a>", "<a href=#parsing-main-inselectintable title="insertion mode: in
262 select in table">in select in table</a>", "<a href=#parsing-main-inforeign
263 title="insertion mode: in foreign content">in foreign content</a>", "<a
264 href=#after-attribute-value-(quoted)-state title="insertion mode: after body">after body</a>", "<a
265 href=#parsing-main-inframeset title="insertion mode: in frameset">in frameset</a>",
266 "<a href=#after-doctype-name-state title="insertion mode: after frameset">after
267 frameset</a>", "<a href=#after-doctype-public-identifier-state title="insertion mode: after after
268 body">after after body</a>", "<a href=#after-doctype-system-identifier-state title="insertion mode:
269 after after frameset">after after frameset</a>"
270 に変わることができます。挿入モードは、字句がどう処理されるか、 CDATA
271 ブロックに対応するかどうかに影響します。
272
273 #en
274 Seven of these modes, namely "<a href=#parsing-main-inhead title="insertion mode:
275 in head">in head</a>", "<a href=#parsing-main-inbody title="insertion mode: in
276 body">in body</a>", "<a href=#parsing-main-intable title="insertion mode: in
277 table">in table</a>", "<a href=#parsing-main-intbody title="insertion mode: in
278 table body">in table body</a>", "<a href=#parsing-main-intr title="insertion mode:
279 in row">in row</a>", "<a href=#parsing-main-intd title="insertion mode: in
280 cell">in cell</a>", and "<a href=#parsing-main-inselect title="insertion mode: in
281 select">in select</a>", are special, in that the other modes defer to them
282 at various times. When the algorithm below says that the user agent is to
283 do something "<dfn>using the rules for</dfn> the <var
284 title="">m</var> insertion mode", where <var title="">m</var> is one of
285 these modes, the user agent must use the rules described under that
286 <span>insertion mode</span>'s section, but must leave the <span>insertion
287 mode</span> unchanged (unless the rules in that section themselves switch
288 the <span>insertion mode</span>).
289 #ja
290 挿入モードのうちの7つ、"<a href=#parsing-main-inhead title="insertion mode:
291 in head">in head</a>", "<a href=#parsing-main-inbody title="insertion mode: in
292 body">in body</a>", "<a href=#parsing-main-intable title="insertion mode: in
293 table">in table</a>", "<a href=#parsing-main-intbody title="insertion mode: in
294 table body">in table body</a>", "<a href=#parsing-main-intr title="insertion mode:
295 in row">in row</a>", "<a href=#parsing-main-intd title="insertion mode: in
296 cell">in cell</a>", "<a href=#parsing-main-inselect title="insertion mode: in
297 select">in select</a>" は特別で、他のモードが数箇所でこれらのモードに委ねています。
298 後述の算法が利用者エージェントは何かを「<var
299 title="">m</var> 挿入モードの<dfn>規則を用いて</dfn>」
300 (<var title="">m</var> はこれらのモードのいずれか。) 行うと言っている時は、
301 利用者エージェントは、当該挿入モードの節で説明されている規則を用いなければ[[MUST:なりません]]が、
302 挿入モードは変更しないでおかなければ[[MUST:なりません]] (その節の規則自体が挿入モードを切り替える場合を除きます)。
303
304 #en
305 When the insertion mode is switched to "<a href=#parsing-main-inforeign
306 title="insertion mode: in foreign content">in foreign content</a>", the
307 <dfn id=secondary-insertion-mode>secondary insertion mode</dfn> is also set. This
308 secondary mode is used within the rules for the "<a href=#parsing-main-inforeign
309 title="insertion mode: in foreign content">in foreign content</a>" mode to
310 handle HTML (i.e. not foreign) content.
311 #ja
312 挿入モードが "<a href=#parsing-main-inforeign
313 title="insertion mode: in foreign content">in foreign content</a>"
314 に切り替えられる時には、<dfn id=secondary-insertion-mode>二次挿入モード</dfn>も設定されます。
315 この二次モードは、 "<a href=#parsing-main-inforeign
316 title="insertion mode: in foreign content">in foreign content</a>"
317 モードの規則の中で HTML (つまり、異言語でない) 内容を取り扱う際に使用します。
318
319 #en
320 When the steps below require the UA to <dfn id=reset-button-state>reset the insertion
321 mode appropriately</dfn>, it means the UA must follow these steps:
322 #ja
323 後述の段階が利用者エージェントに<dfn id=reset-button-state>挿入モードを適切に再設定する</dfn>ことを要求する場合、
324 利用者エージェントは次の段階に従わなければ[[MUST:ならない]]ことを意味しています。
325
326 #pattern
327 Let * be false.
328 #ja
329 $1 を偽とします。
330
331 #en
332 Let <var title="">node</var> be the last node in the <a
333 href=#stack-of-open-elements>stack of open elements</a>.
334 #ja
335 <var title="">node</var> を<a
336 href=#stack-of-open-elements>開いている要素のスタック</a>の最後の節点とします。
337
338 #en
339 If <var title="">node</var> is the first node in the stack of open
340 elements, then set <var title="">last</var> to true and set <var
341 title="">node</var> to the <var title="">context</var> element. (<a
342 href=#fragment-case>fragment case</a>)
343 #ja
344 <var title="">node</var> が開いている要素のスタックの最初の節点の場合、
345 <var title="">last</var> を真に設定し、 <var
346 title="">node</var> を <var title="">context</var> 要素に設定します。
347 (<a
348 href=#fragment-case>素片の場合</a>)
349
350 #pattern
351 If <var title="">node</var> is a * element, then
352 switch the <span>insertion mode</span> to "*" and abort these steps.
353 (<a href=#fragment-case>fragment case</a>)
354 #ja
355 <var title="">node</var> が $1 要素の場合、挿入モードを "$2" に切り替え、
356 これらの段階を停止します。
357 (<a
358 href=#fragment-case>素片の場合</a>)
359
360 #pattern
361 If <var title="">node</var> is a * element, then
362 switch the <span>insertion mode</span> to "*" and abort these steps.
363 #ja
364 <var title="">node</var> が $1
365 要素の場合、挿入モードを "$2" に切り替え、
366 これらの段階を停止します。
367
368 #en
369 If <var title="">node</var> is a <code><a href=#the-td-element>td</a></code> or
370 <code><a href=#the-th-element>th</a></code> element and <var title="">last</var> is
371 false, then switch the <span>insertion mode</span> to "<a href=#parsing-main-intd title="insertion mode: in cell">in cell</a>" and abort these steps.
372 #ja
373 <var title="">node</var> が <code><a href=#the-td-element>td</a></code> 要素か
374 <code><a href=#the-th-element>th</a></code> 要素の場合で <var title="">last</var>
375 が偽の場合、挿入モードを "<a href=#parsing-main-intd title="insertion mode: in cell">in cell</a>" に切り替え、これらの段階を停止します。
376
377 #en
378 If <var title="">node</var> is an element from the <a
379 href=#mathml-namespace>MathML
380 namespace</a><!--XXXSVG or the <span>SVG namespace</span>-->, then switch
381 the <span>insertion mode</span> to "<a href=#parsing-main-inforeign
382 title="insertion mode: in foreign content">in foreign content</a>", let
383 the <a href=#secondary-insertion-mode>secondary insertion mode</a> be "<a
384 href=#parsing-main-inbody title="insertion mode: in body">in body</a>", and abort
385 these steps.
386 #ja
387 <var title="">node</var> が <a
388 href=#mathml-namespace>MathML
389 名前空間</a>の要素の場合、挿入モードを "<a href=#parsing-main-inforeign
390 title="insertion mode: in foreign content">in foreign content</a>"
391 に切り替え、<a href=#secondary-insertion-mode>二次挿入モード</a>を "<a
392 href=#parsing-main-inbody title="insertion mode: in body">in body</a>"
393 とし、これらの段階を停止します。
394
395 #en
396 If <var title="">node</var> is a <code><a href=#the-head-element>head</a></code>
397 element, then switch the <span>insertion mode</span> to "<a
398 href=#parsing-main-inbody title="insertion mode: in body">in body</a>" ("<a
399 href=#parsing-main-inbody title="insertion mode: in body">in body</a>"! <em> not
400 "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>"</em>!)
401 and abort these steps. (<a href=#fragment-case>fragment case</a>)
402 #ja
403 <var title="">node</var> が <code><a href=#the-head-element>head</a></code>
404 要素の場合、挿入モードを "<a
405 href=#parsing-main-inbody title="insertion mode: in body">in body</a>" ("<a
406 href=#parsing-main-inbody title="insertion mode: in body">in body</a>"! <em>"<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>"
407 ではなく</em>!) に切り替え、これらの段階を停止します。
408 (<a href=#fragment-case>素片の場合</a>)
409
410 #en
411 If <var title="">node</var> is an <code><a
412 href=#the-html-element>html</a></code> element, then: if the <a
413 href=#head-element-pointer><code title="">head</code> element pointer</a> is
414 null, switch the <span>insertion mode</span> to "<a href=#before-attribute-value-state
415 title="insertion mode: before head">before head</a>", otherwise, switch
416 the <span>insertion mode</span> to "<a href=#after-attribute-name-state title="insertion
417 mode: after head">after head</a>". In either case, abort these steps. (<a
418 href=#fragment-case>fragment case</a>)
419 #ja
420 <var title="">node</var> が <code><a
421 href=#the-html-element>html</a></code> 要素の場合: <a
422 href=#head-element-pointer><code title="">head</code> 要素指示子</a>が null
423 である場合には、挿入モードを "<a href=#before-attribute-value-state
424 title="insertion mode: before head">before head</a>"
425 に切り替えます。そうでない場合には、挿入モードを "<a href=#after-attribute-name-state title="insertion
426 mode: after head">after head</a>" に切り替えます。いずれの場合にも、
427 これらの段階を停止します。 (<a href=#fragment-case>素片の場合</a>)
428
429 #en
430 If <var title="">last</var> is true, then switch the <span>insertion
431 mode</span> to "<a href=#parsing-main-inbody title="insertion mode: in body">in
432 body</a>" and abort these steps. (<a href=#fragment-case>fragment case</a>)
433 #ja
434 <var title="">last</var> が真であれば、挿入モードを
435 "<a href=#parsing-main-inbody title="insertion mode: in body">in
436 body</a>" に切り替え、これらの段階を停止します。
437 (<a href=#fragment-case>素片の場合</a>)
438
439 #en
440 Let <var title="">node</var> now be the node before <var
441 title="">node</var> in the <a href=#stack-of-open-elements>stack of open elements</a>.
442 #ja
443 新たな <var title="">node</var> を<a href=#stack-of-open-elements>開いている要素のスタック</a>で <var
444 title="">node</var> の前にある節点とします。
445
446
447
448
449
450
451 #pattern
452 A sequence of bytes starting with: *
453 #ja
454 $1 で始まるバイト列
455
456 #en
457 Any other byte
458 #ja
459 その他のバイト
460
461 #en
462 Consume the <a href=#next-input-character>next input character</a>:
463 #ja
464 <a href=#next-input-character>次入力文字</a>を消費:
465
466 #en
467 A comment token
468 #ja
469 注釈字句
470
471 #en
472 A DOCTYPE token
473 #ja
474 DOCTYPE 字句
475
476 #pattern
477 A start tag whose tag name is "*"
478 #ja
479 タグ名が "$1" の開始タグ
480
481 #pattern
482 A start tag whose tag name is one of: *
483 #ja
484 タグ名が $1 のいずれかの開始タグ
485
486 #pattern
487 An end tag whose tag name is "*"
488 #ja
489 タグ名が "$1" の終了タグ
490
491 #pattern
492 An end tag whose tag name is one of: *
493 #ja
494 タグ名が $1 のいずれかの終了タグ
495
496 #en
497 Any other start tag
498 #ja
499 その他の開始タグ
500
501 #en
502 Any other end tag
503 #ja
504 その他の終了タグ
505
506 #en
507 Anything else
508 #ja
509 その他のもの
510
511 #en
512 Run the following algorithm:
513 #ja
514 次の算法を実行します:
515
516 #en
517 Otherwise:
518 #ja
519 それ以外の場合:
520
521 #pattern
522 Return to step *.
523 #ja
524 手順 $1 に戻ります。
525
526 #pattern
527 Act as if a start tag token with the tag name "*" had been seen,
528 then reprocess the current token.
529 #ja
530 タグ名が "$1" の開始タグ字句を見たかのように動作してから、
531 現在字句を再処理します。
532
533 #en
534 <a href=#parse-a-local-date-and-time-string>Parse error</a>.
535 #ja
536 <a href=#parse-a-local-date-and-time-string>構文解析誤り</a>。
537
538 #en
539 <a href=#parse-a-local-date-and-time-string>Parse error</a>. Ignore the token.
540 #ja
541 <a href=#parse-a-local-date-and-time-string>構文解析誤り</a>。字句を無視します。
542
543 #en
544 Take a deep breath, then act as described in the "any other end tag"
545 entry below.
546 #ja
547 深呼吸をして、後述の「その他の終了タグ」の項で説明されているように作用します。
548
549 #en
550 If the <a href=#list-of5>list of active formatting elements</a>
551 contains an element whose tag name is "a" between the end of the list
552 and the last marker on the list (or the start of the list if there is no
553 marker on the list), then this is a <a href=#parse-a-date-string>parse error</a>;
554 act as if an end tag with the tag name "a" had been seen, then remove
555 that element from the <a href=#list-of5>list of active formatting
556 elements</a> and the <a href=#stack-of-open-elements>stack of open elements</a> if the
557 end tag didn't already remove it (it might not have if the element is
558 not <a href=#has-an-element-in-table-scope title="has an element in table scope">in table
559 scope</a>).
560 #ja
561 <a href=#list-of5>活性書式付け要素のリスト</a>がタグ名 "a"
562 の要素をリストの終わりとリスト中のリスト・マーカー (またはリスト中にマーカーがない場合はリストのはじめ)
563 の間に含まれている場合には、
564 これは<a href=#parse-a-date-string>構文解析誤り</a>です。
565 タグ名 "a" の終了タグを見たかのように作用した後に、
566 その要素を<a href=#list-of5>活性書式付け要素のリスト</a>と<a href=#stack-of-open-elements>開いている要素のスタック</a>
567 (終了タグにより除去されていない場合。要素が<a href=#has-an-element-in-table-scope title="has an element in table scope">表範囲中</a>にない場合には除去されていないかもしれません。) から除去します。
568
569 #en
570 In the non-conforming stream
571 <code>&lt;a&nbsp;href=a>a&lt;table>&lt;a&nbsp;href=b>b&lt;/table>x</code>,
572 the first <code><a href=#the-a-element>a</a></code> element would be closed upon
573 seeing the second one, and the "x" character would be inside a link to
574 "b", not to "a". This is despite the fact that the outer <code><a
575 href=#the-a-element>a</a></code> element is not in table scope (meaning that a
576 regular <code>&lt;/a></code> end tag at the start of the table wouldn't
577 close the outer <code><a href=#the-a-element>a</a></code> element).
578 #ja
579 不適合ストリーム
580 <code>&lt;a&nbsp;href=a>a&lt;table>&lt;a&nbsp;href=b>b&lt;/table>x</code>
581 において、最初の <code><a href=#the-a-element>a</a></code> 要素は2つ目のを見たときに閉じられ、
582 「x」文字は「a」へのリンクではなく、「b」へのリンクの内側に入ります。
583 これは、外側の <code><a
584 href=#the-a-element>a</a></code> 要素が表範囲中にないためです
585 (つまり、表の最初に普通の <code>&lt;/a></code> 終了タグがあったとしても、
586 外側の <code><a href=#the-a-element>a</a></code> 要素を閉じないということになります)。
587
588 #en
589 <a href=#reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>,
590 if any.
591 #ja
592 <a href=#reconstruct-the-active-formatting-elements>活性書式付け要素を再構築</a>できれば、します。
593
594 #en
595 <a href=#insert-an-html-element>Insert an HTML element</a> for the token. Add that
596 element to the <a href=#list-of5>list of active formatting
597 elements</a>.
598 #ja
599 当該字句について <a href=#insert-an-html-element>HTML 要素を挿入</a>します。
600 その要素を<a href=#list-of5>活性書式付け要素のリスト</a>に追加します。
601
602
603
604 #en
605 The behavior further depends on the character after the U+0023 NUMBER
606 SIGN:
607 #ja
608 動作は更に U+0023 NUMBER
609 SIGN の次の文字によって決まります。
610
611
612 #en
613 Consume the U+0023 NUMBER SIGN.
614 #ja
615 U+0023 NUMBER SIGN を消費します。
616
617 #en
618 Consume the X.
619 #ja
620 X を消費します。
621
622 #en
623 Follow the steps below, but using the range of characters U+0030
624 DIGIT ZERO through to U+0039 DIGIT NINE, U+0061 LATIN SMALL LETTER A
625 through to U+0066 LATIN SMALL LETTER F, and U+0041 LATIN CAPITAL
626 LETTER A, through to U+0046 LATIN CAPITAL LETTER F (in other words,
627 0-9, A-F, a-f).
628 #ja
629 次の段階に従いますが、文字の範囲 U+0030
630 DIGIT ZERO ~ U+0039 DIGIT NINE、U+0061 LATIN SMALL LETTER A
631 ~ U+0066 LATIN SMALL LETTER F、 U+0041 LATIN CAPITAL
632 LETTER A ~ U+0046 LATIN CAPITAL LETTER F (つまり
633 0-9、A-F、a-f) を使います。
634
635
636 #en
637 When it comes to interpreting the number, interpret it as a
638 hexadecimal number.
639 #ja
640 数を解釈する折には、十六進数として解釈します。
641
642 #en
643 Follow the steps below, but using the range of characters U+0030
644 DIGIT ZERO through to U+0039 DIGIT NINE (i.e. just 0-9).
645 #ja
646 次の段階に従いますが、文字の範囲 U+0030
647 DIGIT ZERO ~ U+0039 DIGIT NINE (つまり 0-9 だけ) を使います。
648
649 #en
650 When it comes to interpreting the number, interpret it as a decimal
651 number.
652 #ja
653 数を解釈する折には、十進数として解釈します。
654
655 #en
656 Consume as many characters as match the range of characters given
657 above.
658 #ja
659 前述の文字の範囲に一致する文字を、一致するだけすべて消費します。
660
661 #en
662 If no characters match the range, then don't consume any characters
663 (and unconsume the U+0023 NUMBER SIGN character and, if appropriate, the
664 X character). This is a <a href=#parse-a-date-string>parse error</a>; nothing is
665 returned.
666 #ja
667 範囲に一致する文字がない場合は、文字を消費しません
668 (更に、 U+0023 NUMBER SIGN 文字と、必要であれば X 文字をも消費しなかったこととします)。
669 これは<a href=#parse-a-date-string>構文解析誤り</a>です。何も返しません。
670
671 #en
672 Otherwise, if the next character is a U+003B SEMICOLON, consume that
673 too. If it isn't, there is a <a href=#parse-a-date-string>parse error</a>.
674 #ja
675 そうでない場合、次の文字が U+003B SEMICOLON
676 であれば、これも消費します。そうでない場合は、<a href=#parse-a-date-string>構文解析誤り</a>です。
677
678 #en
679 If one or more characters match the range, then take them all and
680 interpret the string of characters as a number (either hexadecimal or
681 decimal as appropriate).
682 #ja
683 1文字以上が一致した場合は、それらすべてによる文字列を数 (十六進数または十進数の適切な方)
684 として解釈します。
685
686 #en
687 If that number is one of the numbers in the first column of the
688 following table, then this is a <a href=#parse-a-date-string>parse error</a>. Find
689 the row with that number in the first column, and return a character
690 token for the Unicode character given in the second column of that row.
691 #ja
692 その数が次の表の最初の列の数のいずれかである場合は、
693 <a href=#parse-a-date-string>構文解析誤り</a>です。
694 その数が最初の列に現れる行を探し、
695 その行の2つ目の列に示された Unicode 文字の文字字句を返します。
696
697 #en
698 Number
699 #ja
700
701
702 #en
703 Unicode character
704 #ja
705 Unicode 文字
706
707 #en
708 Otherwise, if the number is in the range 0x0000 to 0x0008, <!--
709 space characters allowed -->
710 0x000E to 0x001F, <!-- ASCII allowed
711 --> 0x007F
712 <!--to 0x0084, (0x0085 NEL not allowed), 0x0086--> to 0x009F, 0xD800 to
713 0xDFFF <!-- surrogates not allowed -->, 0xFDD0 to 0xFDDF, or is one of
714 0xFFFE, 0xFFFF, 0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF,
715 0x4FFFE, 0x4FFFF, 0x5FFFE, 0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF,
716 0x8FFFE, 0x8FFFF, 0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF,
717 0xCFFFE, 0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF,
718 0x10FFFE, or 0x10FFFF, or is higher than 0x10FFFF, then this is a <a
719 href=#parse-a-date-string>parse error</a>; return a character token for the U+FFFD
720 REPLACEMENT CHARACTER character instead.
721 #ja
722 それ以外の場合、数が範囲 0x0000 ~ 0x0008、<!--
723 space characters allowed -->
724 0x000E、 0x001F、<!-- ASCII allowed
725 --> 0x007F
726 <!--to 0x0084, (0x0085 NEL not allowed), 0x0086--> ~ 0x009F、
727 0xD800 ~
728 0xDFFF <!-- surrogates not allowed -->、0xFDD0 ~ 0xFDDF
729 のいずれかにあるか、
730 0xFFFE、0xFFFF、0x1FFFE、0x1FFFF、0x2FFFE、0x2FFFF、0x3FFFE、0x3FFFF、
731 0x4FFFE、0x4FFFF、0x5FFFE、0x5FFFF、0x6FFFE、0x6FFFF、 0x7FFFE、0x7FFFF、
732 0x8FFFE、0x8FFFF、0x9FFFE、0x9FFFF、0xAFFFE、0xAFFFF、0xBFFFE、0xBFFFF、
733 0xCFFFE、0xCFFFF、0xDFFFE、0xDFFFF、0xEFFFE、0xEFFFF、0xFFFFE、0xFFFFF、
734 0x10FFFE、0x10FFFF のいずれかであるか、
735 0x10FFFF より大きい場合、<a
736 href=#parse-a-date-string>構文解析誤り</a>です。
737 代わりに U+FFFD
738 REPLACEMENT CHARACTER 文字の文字字句を返します。
739
740
741 #en
742 Otherwise, return a character token for the Unicode character whose
743 code point is that number.
744 #ja
745 それ以外の場合、符号位置がその数である Unicode 文字の文字字句を返します。
746
747 #en
748 Consume the maximum number of characters possible, with the consumed
749 characters matching one of the identifiers in the first column of the <a
750 href=#named-character-references>named character references</a> table (in a <a
751 href=#case-sensitive>case-sensitive</a> manner).
752 #ja
753 <a
754 href=#named-character-references>名前付き文字参照</a>の表の最初の列にある識別子のいずれかと一致するような、
755 可能な最大数の文字を消費します。
756
757 #en
758 <a href=#insert-an-html-element>Insert an HTML element</a> for the token.
759 #ja
760 当該字句について <a href=#insert-an-html-element>HTML
761 要素を挿入</a>します。
762
763 #en
764 Set the <a href=#head-element-pointer><code title="">head</code> element
765 pointer</a> to the newly created <code><a href=#the-head-element>head</a></code>
766 element.
767 #ja
768 <a href=#head-element-pointer><code title="">head</code>
769 要素指示子</a>を新たに作られた <code><a href=#the-head-element>head</a></code>
770 要素に設定します。
771
772
773 #en
774 Switch the <span>insertion mode</span> to "<a href=#parsing-main-inhead
775 title="insertion mode: in head">in head</a>".
776 #ja
777 <span>挿入モード</span>を "<a href=#parsing-main-inhead
778 title="insertion mode: in head">in head</a>" に切り替えます。
779
780
781 #en
782 Act as if a start tag token with the tag name "head" and no attributes
783 had been seen, then reprocess the current token.
784 #ja
785 タグ名 "head" で属性のない開始タグ字句を見たかのように作用した後、
786 現在の字句を再処理します。
787
788 #en
789 This will result in an empty <code><a
790 href=#the-head-element>head</a></code> element being generated, with the current
791 token being reprocessed in the "<a href=#the-after-head-insertion-mode title="insertion mode:
792 after head">after head</a>" <span>insertion mode</span>.
793 #ja
794 この結果空の <code><a
795 href=#the-head-element>head</a></code> 要素が生成され、
796 現在の字句は "<a href=#the-after-head-insertion-mode title="insertion mode:
797 after head">after head</a>" <span>挿入モード</span>で再処理されることとなります。
798
799 #pattern
800 <span class=secno>* </span>The "<dfn
801 id=* title="insertion mode: *">*</dfn>" insertion mode
802 #ja
803 <span class=secno>$1 </span> "<dfn
804 id=$2 title="insertion mode: $3">$4</dfn>" 挿入モード
805
806 #pattern
807 When the <span>insertion mode</span> is "<a href=#*
808 title="insertion mode: *">*</a>", tokens must be handled as
809 follows:
810 #ja
811 <span>挿入モード</span>が "<a href=#$1
812 title="insertion mode: $2">$3</a>" の時、
813 字句は次のように取り扱わなければ[[MUST:なりません]]。
814
815
816 #en
817 <a href=#insert-a-character title="insert a character">Insert the character</a>
818 into the <a href=#current-node>current node</a>.
819 #ja
820 <a href=#current-node>現在節点</a>に<a href=#insert-a-character title="insert a character">文字を挿入</a>します。
821
822 #pattern
823 <span class=secno>* </span>Overview of the parsing model
824 #ja
825 <span class=secno>$1 </span>構文解析モデルの概要
826
827 #en
828 The input to the HTML parsing process consists of a stream of
829 Unicode characters, which is passed through a
830 <a href=#tokenization>tokenization</a> stage (lexical analysis) followed by a
831 <a href=#tree-construction>tree construction</a> stage (semantic analysis). The output
832 is a <code>Document</code> object.
833 #ja
834 HTML 構文解析処理への入力は、Unicode 文字の列によって構成され、
835 まずは<a href=#tokenization>字句化</a>段階 (字句解析)
836 に渡され、その後に<a href=#tree-construction>木構築</a> 段階 (意味解析)
837 に渡されます。
838 出力は、 <code>Document</code> オブジェクトです。
839
840 #en
841 Implementations that <a href=#non-scripted>do not
842 support scripting</a> do not have to actually create a DOM
843 <code>Document</code> object, but the DOM tree in such cases is
844 still used as the model for the rest of the specification.
845 #ja
846 <a href=#non-scripted>スクリプティングに対応しない</a>実装は実際に DOM
847 <code>Document</code> オブジェクトを作る必要はありませんが、
848 その場合であっても、この仕様書の残りの部分のモデルとしてはやはり DOM 木を使います。
849
850 #en
851 In the common case, the data handled by the tokenization stage
852 comes from the network, but <a href=#dynamic-markup-insertion title="dynamic markup
853 insertion">it can also come from script</a>, e.g. using the <code title=dom-document-write-HTML><a href=#dom-document-write-html>document.write()</a></code> API.
854 #ja
855 多くの場合は字句化段階が取り扱うデータはネットワークから来るものですが、
856 <a href=#dynamic-markup-insertion title="dynamic markup
857 insertion">スクリプトから</a>も、例えば <code title=dom-document-write-HTML><a href=#dom-document-write-html>document.write()</a></code> API
858 によって来ることがあります。
859
860 #en
861 <img alt="" src=images/parsing-model-overview.png>
862 #ja
863 <img alt="" src=http://www.whatwg.org/specs/web-apps/current-work/images/parsing-model-overview.png>
864
865 #en
866 There is only one set of state for the
867 tokeniser stage and the tree construction stage, but the tree
868 construction stage is reentrant, meaning that while the tree
869 construction stage is handling one token, the tokeniser might be
870 resumed, causing further tokens to be emitted and processed before
871 the first token's processing is complete.
872 #ja
873 字句化器段階と木構築段階の状態は一揃いしかありませんが、
874 木構築段階は再入可能であり、木構築段階がある字句を処理している間に字句化器が再開して更に字句を放出し、
875 最初の字句の処理が完了する前に新しい字句が処理されることがあります。
876
877
878 #en
879 In the following example, the tree construction stage will be
880 called upon to handle a "p" start tag token while handling the
881 "script" start tag token:
882 #ja
883 次の例では、 "script" 開始タグ字句を処理している間に木構築段階が "p" 開始タグ字句を処理するために呼び出されることとなります。
884
885 #pattern
886 <span class=secno>* </span>The <dfn>input stream</dfn>
887 #ja
888 <span class=secno>$1 </span><dfn>入力ストリーム</dfn>
889
890 #en
891 The stream of Unicode characters that consists the input to the
892 tokenization stage will be initially seen by the user agent as a
893 stream of bytes (typically coming over the network or from the local
894 file system). The bytes encode the actual characters according to a
895 particular <em>character encoding</em>, which the user agent must
896 use to decode the bytes into characters.
897 #ja
898 字句か段階への入力を構成する Unicode 文字のストリームは、はじめ利用者エージェントに
899 (普通はネットワークか局所ファイル・システムから来た) バイトのストリームとして見えます。
900 バイトは特定の<em>文字符号化</em>に従って実際の文字を符号化しており、
901 利用者エージェントはその文字符号化を使ってバイトを文字に復号しなければ[[MUST:なりません]]。
902
903 #en
904 For XML documents, the algorithm user agents must
905 use to determine the character encoding is given by the XML
906 specification. This section does not apply to XML documents. <a href=#refsXML>[XML]</a>
907 #ja
908 XML 文書に関しては、文字符号化を決定するために利用者エージェントが使わなければ[[MUST:ならない]]算法は
909 XML 仕様書で与えられています。この節は XML 文書には適用しません。 <a href=#refsXML>[XML]</a>
910
911 #pattern
912 <span class=secno>* </span>Determining the character encoding
913 #ja
914 <span class=secno>$1 </span>文字符号化の決定
915
916 #en
917 In some cases, it might be impractical to unambiguously determine
918 the encoding before parsing the document. Because of this, this
919 specification provides for a two-pass mechanism with an optional
920 pre-scan. Implementations are allowed, as described below, to apply
921 a simplified parsing algorithm to whatever bytes they have available
922 before beginning to parse the document. Then, the real parser is
923 started, using a tentative encoding derived from this pre-parse and
924 other out-of-band metadata. If, while the document is being loaded,
925 the user agent discovers an encoding declaration that conflicts with
926 this information, then the parser can get reinvoked to perform a
927 parse of the document with the real encoding.
928 #ja
929 場合によっては、文書の構文解析の前に符号化を曖昧なく決定することが非現実的かもしれません。
930 このため、この仕様書は任意選択の前走査を伴う2パス機構を提供します。
931 実装は、後述の通り、文書の構文解析を始める前に、利用可能になっているバイトに対して単純化した構文解析算法を適用することが認められています。
932 その後、実際の構文解析器が、この前構文解析やその他の外部メタデータによって得られた暫定符号化を用いて開始します。
933 文書が読み込まれる間に利用者エージェントがその情報と矛盾する符号化宣言を発見した場合、
934 構文解析器は、実際の符号化によって文書の構文解析を行うために再呼び出しされることがあります。

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24