#en
9.2 Parsing HTML documents
#ja
9.2 HTML 文書の構文解析
#en
This section only applies to user agents, data mining tools, and
conformance checkers.
#ja
この節は利用者エージェント、データ・マイニング・ツール、
適合性検査器のみに適用されます。
#en
The rules for parsing XML documents (and
thus XHTML documents) into DOM trees are covered by
the XML and Namespaces in XML specifications, and are out of scope of this
specification. [XML] [XMLNS]
#ja
XML 文書 (や XHTML 文書)
を構文解析して DOM 木を得るための規則は XML や XML 名前空間の仕様書で扱われており、
この仕様書の適用範囲外です。 [XML] HTML documents, user agents must use the
parsing rules described in this section to generate the DOM trees.
Together, these rules define what is referred to as the HTML parser.
#ja
HTML 文書については、利用者エージェントは、 DOM
木を生成するためにこの節で説明する構文解析規則を使用しなければ[[MUST:なりません]]。
また、この規則はHTML 構文解析器と呼ばれるものを定義します。
#en
While the HTML form of HTML5 bears a close resemblance to SGML and XML,
it is a separate language with its own parsing rules.
#ja
HTML5 の HTML 形式は SGML や XML によく似ていますが、
独自の構文解析規則を持つ別の言語です。
#en
Some earlier versions of HTML (in particular from HTML2 to HTML4) were
based on SGML and used SGML parsing rules. However, few (if any) web
browsers ever implemented true SGML parsing for HTML documents; the only
user agents to strictly handle HTML as an SGML application have
historically been validators. The resulting confusion — with
validators claiming documents to have one representation while widely
deployed Web browsers interoperably implemented a different
representation — has wasted decades of productivity. This version
of HTML thus returns to a non-SGML basis.
#ja
以前のいくつかの版の HTML (特に HTML2 から HTML4 まで) は SGML
に基づき、 SGML の構文解析規則を用いていました。しかし、 HTML
文書用に真の SGML 構文解析を実装していたウェブ・ブラウザは (あったとしても)
皆無に近い数でした。 HTML を厳密に SGML 応用として扱う唯一の利用者エージェントは歴史的に妥当性検証器だけでした。
その結果、妥当性検査器は文書がある形式であることを要求し、
一方で広く実用されている Web ブラウザはそれとは異なる形式を相互運用可能な形で実装するという混乱が生じ、
生産性を大きく低下させています。
ですので、この版の HTML は非 SGML ベースに回帰します。
#en
Authors interested in using SGML tools in their authoring pipeline are
encouraged to use XML tools and the XML serialization of HTML5.
#ja
文書準備の過程で SGML ツールを使いたいと考える著者には、
XML ツールと HTML5 の XML 直列化を用いることをお勧めします。
#regexp
A sequence of bytes starting with: *
#ja
$1 で始まるバイト列
#en
Any other byte
#ja
その他のバイト
#en
Consume the next input character:
#ja
次入力文字を消費:
#en
A comment token
#ja
注釈字句
#en
A DOCTYPE token
#ja
DOCTYPE 字句
#regexp
A start tag whose tag name is "*"
#ja
タグ名が "$1" の開始タグ
#regexp
A start tag whose tag name is one of: *
#ja
タグ名が $1 のいずれかの開始タグ
#regexp
An end tag whose tag name is "*"
#ja
タグ名が "$1" の終了タグ
#regexp
An end tag whose tag name is one of: *
#ja
タグ名が $1 のいずれかの終了タグ
#en
Any other start tag
#ja
その他の開始タグ
#en
Any other end tag
#ja
その他の終了タグ
#en
Anything else
#ja
その他のもの
#en
Run the following algorithm:
#ja
次の算法を実行します:
#en
Otherwise:
#ja
それ以外の場合:
#regexp
Return to step *.
#ja
手順 $1 に戻ります。
#regexp
Act as if a start tag token with the tag name "*" had been seen,
then reprocess the current token.
#ja
タグ名が "$1" の開始タグ字句を見たかのように動作してから、
現在字句を再処理します。
#en
Parse error.
#ja
構文解析誤り。
#en
Parse error. Ignore the token.
#ja
構文解析誤り。字句を無視します。