| 1 |
wakaba |
1.2 |
#en |
| 2 |
|
|
<span class=secno>9.2 </span>Parsing HTML documents |
| 3 |
|
|
#ja |
| 4 |
|
|
<span class=secno>9.2 </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-">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-0>HTML parser</dfn>. |
| 29 |
|
|
#ja |
| 30 |
|
|
<a href="#html-">HTML 文書</a>については、利用者エージェントは、 DOM |
| 31 |
|
|
木を生成するためにこの節で説明する構文解析規則を使用しなければ[[MUST:なりません]]。 |
| 32 |
|
|
また、この規則は<dfn |
| 33 |
|
|
id=html-0>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 — with |
| 48 |
|
|
validators claiming documents to have one representation while widely |
| 49 |
|
|
deployed Web browsers interoperably implemented a different |
| 50 |
|
|
representation — 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 |
wakaba |
1.3 |
#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=parse2 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=parse2 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 |
wakaba |
1.2 |
|
| 107 |
|
|
|
| 108 |
|
|
|
| 109 |
|
|
|
| 110 |
wakaba |
1.1 |
#regexp |
| 111 |
|
|
A sequence of bytes starting with: * |
| 112 |
|
|
#ja |
| 113 |
|
|
$1 で始まるバイト列 |
| 114 |
|
|
|
| 115 |
|
|
#en |
| 116 |
|
|
Any other byte |
| 117 |
|
|
#ja |
| 118 |
|
|
その他のバイト |
| 119 |
|
|
|
| 120 |
|
|
#en |
| 121 |
|
|
Consume the <a href="#next-input">next input character</a>: |
| 122 |
|
|
#ja |
| 123 |
|
|
<a href="#next-input">次入力文字</a>を消費: |
| 124 |
|
|
|
| 125 |
|
|
#en |
| 126 |
|
|
A comment token |
| 127 |
|
|
#ja |
| 128 |
|
|
注釈字句 |
| 129 |
|
|
|
| 130 |
|
|
#en |
| 131 |
|
|
A DOCTYPE token |
| 132 |
|
|
#ja |
| 133 |
|
|
DOCTYPE 字句 |
| 134 |
|
|
|
| 135 |
|
|
#regexp |
| 136 |
|
|
A start tag whose tag name is "*" |
| 137 |
|
|
#ja |
| 138 |
|
|
タグ名が "$1" の開始タグ |
| 139 |
|
|
|
| 140 |
|
|
#regexp |
| 141 |
|
|
A start tag whose tag name is one of: * |
| 142 |
|
|
#ja |
| 143 |
|
|
タグ名が $1 のいずれかの開始タグ |
| 144 |
|
|
|
| 145 |
|
|
#regexp |
| 146 |
|
|
An end tag whose tag name is "*" |
| 147 |
|
|
#ja |
| 148 |
|
|
タグ名が "$1" の終了タグ |
| 149 |
|
|
|
| 150 |
|
|
#regexp |
| 151 |
|
|
An end tag whose tag name is one of: * |
| 152 |
|
|
#ja |
| 153 |
|
|
タグ名が $1 のいずれかの終了タグ |
| 154 |
|
|
|
| 155 |
|
|
#en |
| 156 |
|
|
Any other start tag |
| 157 |
|
|
#ja |
| 158 |
|
|
その他の開始タグ |
| 159 |
|
|
|
| 160 |
|
|
#en |
| 161 |
|
|
Any other end tag |
| 162 |
|
|
#ja |
| 163 |
|
|
その他の終了タグ |
| 164 |
|
|
|
| 165 |
|
|
#en |
| 166 |
|
|
Anything else |
| 167 |
|
|
#ja |
| 168 |
|
|
その他のもの |
| 169 |
|
|
|
| 170 |
|
|
#en |
| 171 |
|
|
Run the following algorithm: |
| 172 |
|
|
#ja |
| 173 |
|
|
次の算法を実行します: |
| 174 |
|
|
|
| 175 |
|
|
#en |
| 176 |
|
|
Otherwise: |
| 177 |
|
|
#ja |
| 178 |
|
|
それ以外の場合: |
| 179 |
|
|
|
| 180 |
|
|
#regexp |
| 181 |
|
|
Return to step *. |
| 182 |
|
|
#ja |
| 183 |
|
|
手順 $1 に戻ります。 |
| 184 |
|
|
|
| 185 |
|
|
#regexp |
| 186 |
|
|
Act as if a start tag token with the tag name "*" had been seen, |
| 187 |
|
|
then reprocess the current token. |
| 188 |
|
|
#ja |
| 189 |
|
|
タグ名が "$1" の開始タグ字句を見たかのように動作してから、 |
| 190 |
|
|
現在字句を再処理します。 |
| 191 |
|
|
|
| 192 |
|
|
#en |
| 193 |
|
|
<a href="#parse1">Parse error</a>. |
| 194 |
|
|
#ja |
| 195 |
|
|
<a href="#parse1">構文解析誤り</a>。 |
| 196 |
|
|
|
| 197 |
|
|
#en |
| 198 |
|
|
<a href="#parse1">Parse error</a>. Ignore the token. |
| 199 |
|
|
#ja |
| 200 |
|
|
<a href="#parse1">構文解析誤り</a>。字句を無視します。 |