blob: 85ac9582907cbc020a093f2d3516937e61638dbc [file] [log] [blame]
<?xml version="1.0"?>
<!DOCTYPE spec SYSTEM "spec.dtd" [
<!-- 日本語訳のための解析対象実体(ここから) -->
<!ENTITY TR-or-Rec "仕様書">
<!-- <!ENTITY TR-or-Rec "標準情報(TR)"> -->
<!ENTITY eTR-or-Rec "specification">
<!-- <!ENTITY eTR-or-Rec "technical report(TR)"> -->
<!ENTITY application "アプリケーション">
<!ENTITY error "エラー">
<!ENTITY fatal-error "致命的エラー">
<!ENTITY parsed-data "解析されるデータ">
<!ENTITY unparsed-data "解析されないデータ">
<!ENTITY parsed-entity "解析対象実体">
<!ENTITY parser "パーサ">
<!ENTITY unparsed-entity "解析対象外実体">
<!ENTITY well-formed "整形式">
<!ENTITY valid "妥当">
<!ENTITY validity "妥当性">
<!ENTITY escape "別扱い">
<!ENTITY prolog "書き">
<!ENTITY surrogate-blocks "サロゲートブロック">
<!ENTITY letter "字">
<!ENTITY ideographic "統合漢字">
<!ENTITY markup "マーク付け">
<!ENTITY left-angle-bracket "不等号(小なり)">
<!ENTITY right-angle-bracket "不等号(大なり)">
<!ENTITY string "文字列">
<!ENTITY char-string "文字列"><!-- string of chararacters,
character strings, strings,
characters はすべて文字列とする -->
<!ENTITY replacement-text "置換テキスト">
<!ENTITY single-quote "一重引用符">
<!ENTITY double-quote "二重引用符">
<!ENTITY adaptations-annex "適用附属書">
<!ENTITY root "ルート">
<!ENTITY base-character "基底文字">
<!ENTITY diacritical-mark "発音符"><!--(ダイアクリティカルマーク)を初出のとき補う-->
<!ENTITY composed-form "合成形式">
<!ENTITY standalone "スタンドアロン">
<!ENTITY double-hyphen "二連ハイフン">
<!--<!ENTITY case-fold "大文字か小文字への統一">-->
<!-- <!ENTITY case-fold "比較のとき,大文字と小文字の同一視">-->
<!ENTITY parameter "パラメタ">
<!ENTITY stream "ストリーム">
<!ENTITY validating "妥当性を検証する">
<!ENTITY non-validating "妥当性を検証しない">
<!ENTITY user "ユーザ">
<!--<!ENTITY at-user-option "ユーザがオプションを指定したとき">-->
<!ENTITY at-user-option "ユーザのオプション指定によっては">
<!ENTITY content-particle "内容素子">
<!ENTITY processor "プロセサ">
<!ENTITY default "デフォルト">
<!ENTITY default-value "デフォルト値">
<!ENTITY header "ヘッダ">
<!ENTITY target "ターゲット">
<!ENTITY mixed-content "混合内容">
<!ENTITY country-code "国コード">
<!ENTITY language-code "言語コード">
<!ENTITY version "版"> <!-- version 1.0は第1.0版 -->
<!ENTITY match "マッチ">
<!ENTITY character-value "文字番号">
<!ENTITY byte-order-mark "バイト順マーク">
<!ENTITY bypass "処理しない">
<!ENTITY identifier "識別子">
<!-- <!ENTITY identify "識別する"> -->
<!ENTITY identify "特定する">
<!-- <!ENTITY identified "識別される"> -->
<!ENTITY identified "特定される">
<!ENTITY combining-character "結合文字">
<!ENTITY subset "サブセット">
<!ENTITY token "トークン">
<!ENTITY literal "リテラル">
<!ENTITY parenthesis "かっこ">
<!ENTITY left-parenthesis "開きかっこ">
<!ENTITY right-parenthesis "閉じかっこ">
<!-- あとで気がついたもの JIS X0221を見る必要あり -->
<!ENTITY extender "エクステンダ">
<!ENTITY property "プロパティ">
<!ENTITY property-list "プロパティリスト">
<!ENTITY property-file "プロパティファイル">
<!ENTITY font-decomposition "フォント分解">
<!ENTITY compatibility-decomposition "互換性分解">
<!ENTITY compatibility-area "互換性領域">
<!ENTITY language-identification "言語識別">
<!ENTITY space-character "スペース文字">
<!ENTITY space "スペース">
<!ENTITY code-value "コード値">
<!ENTITY normative "規定の">
<!ENTITY hueristics "ヒューリスティック">
<!ENTITY informative "">
<!ENTITY WebSGML 'ISO 8879へのWebSGML&adaptations-annex;'>
<!ENTITY XML.version "1.0">
<!ENTITY doc.date "1997年12月8日">
<!ENTITY iso6.doc.date "971208">
<!ENTITY w3c.doc.date "97年12月3日">
<!ENTITY draft.day '8日'>
<!ENTITY draft.month '12月'>
<!ENTITY draft.year '1997年'>
<!-- 日本語訳のための解析対象実体(ここまで) -->
<!-- LAST TOUCHED BY: Tim Bray, 3 Dec 1997 -->
<!-- The words 'FINAL EDIT' in comments mark places where changes
need to be made after approval of the document by the ERB, before
publication. -->
<!--
<!ENTITY XML.version "1.0">
<!ENTITY doc.date "8 December 1997">
<!ENTITY iso6.doc.date "971208">
<!ENTITY w3c.doc.date "03-Dec-97">
<!ENTITY draft.day '8'>
<!ENTITY draft.month 'December'>
<!ENTITY draft.year '1997'>
<!ENTITY WebSGML
'WebSGML Adaptations Annex to ISO 8879'>
-->
<!ENTITY newline " ">
<!-- old: <!ENTITY newline "&#8232;"> -->
<!ENTITY lt "<">
<!ENTITY gt ">">
<!--<!ENTITY amp "&"> -->
<!ENTITY xmlpio "'&lt;?xml'">
<!ENTITY pic "'?>'">
<!ENTITY br "\n">
<!ENTITY cellback '#c0d9c0'>
<!-- <!ENTITY mdash "- xx -"> --> <!-- was: <!ENTITY mdash "&#38;#151;"> -->
<!ENTITY com "--">
<!ENTITY como "--">
<!ENTITY comc "--">
<!ENTITY hcro "&amp;#x">
<!-- <!ENTITY nbsp ""> -->
<!-- <!ENTITY nbsp "&#160;"> -->
<!ENTITY magicents "<code>amp</code>,
<code>lt</code>,
<code>gt</code>,
<code>apos</code>,
<code>quot</code>">
<!--日本語訳について: コメントは翻訳対象から外しました。鈴木和夫 -->
<!-- audience and distribution status: for use at publication time -->
<!-- -->
<!ENTITY doc.audience "公開レビュー及び議論">
<!ENTITY doc.distribution "テキスト及び法律上の注意を改変しない限り,
自由に配布してもよい">
]>
<!-- for Panorama *-->
<?VERBATIM "eg" ?>
<spec>
<header>
<title>拡張可能な&markup;言語 (XML)</title>
<version>第1.0&version;</version>
<w3c-designation>PR-xml-&iso6.doc.date;</w3c-designation>
<w3c-doctype>World Wide Web Consortium</w3c-doctype>
<pubdate><day>&draft.day;</day><month>&draft.month;</month><year>&draft.year;</year></pubdate>
<notice><p>この草案は,XML WG及び他の関係者によるレビューのためのものであって,公開の議論のためのものではない。
<!-- FINAL EDIT: FIX --></p></notice>
<publoc>
<loc href="http://www.w3.org/TR/PR-xml-&iso6.doc.date;">
http://www.w3.org/TR/PR-xml-&iso6.doc.date;</loc></publoc>
<prevlocs>
<loc href='http://www.w3.org/TR/WD-xml-961114'>
http://www.w3.org/TR/WD-xml-961114</loc>
<loc href='http://www.w3.org/TR/WD-xml-lang-970331'>
http://www.w3.org/TR/WD-xml-lang-970331</loc>
<loc href='http://www.w3.org/TR/WD-xml-lang-970630'>
http://www.w3.org/TR/WD-xml-lang-970630</loc>
<loc href='http://www.w3.org/TR/WD-xml-970807'>
http://www.w3.org/TR/WD-xml-970807</loc>
<loc href='http://www.w3.org/TR/WD-xml-971117'>
http://www.w3.org/TR/WD-xml-971117</loc>
</prevlocs>
<authlist>
<author><name>Tim Bray</name>
<affiliation>Textuality and Netscape</affiliation>
<email
href="mailto:tbray@textuality.com">tbray@textuality.com</email></author>
<author><name>Jean Paoli</name>
<affiliation>Microsoft</affiliation>
<email href="mailto:jeanpa@microsoft.com">jeanpa@microsoft.com</email></author>
<author><name>C. M. Sperberg-McQueen</name>
<affiliation>University of Illinois at Chicago</affiliation>
<email href="mailto:cmsmcq@uic.edu">cmsmcq@uic.edu</email></author>
</authlist>
<status>
<p>この&TR-or-Rec;は, 1997年12月にWorld Wide Web Consortiumから
公表された勧告案Extensible Markup Language version第1.0版を翻訳し, 技
術的内容を変更することなく作成した&TR-or-Rec;である。This &eTR-or-Rec;
is a translation of the XML proposed recommendation 1.0
published by the World Wide Web Consortium in December 1997. It is
intended that &eTR-or-Rec; is technically identical to the original.</p>
<p>原文にある、著作権に関しての記述を次に示す。The
original copyright notice is shown below:</p>
<p>この版のXMLの規定は,公開レビュー及び議論を
目的とする。テキスト及び法律上の注意を改変しない限り,自由に
配布してもよい。This version of the XML specification is for
public review and discussion. It may be distributed freely,
as long as all text and legal notices remain intact.</p>
<p>この&TR-or-Rec;の元となったXML勧告案は,1998年2月にWorld
Wide Web Consortiumから公表されたXML勧告によってすでに置き換
えられている。この標準情報は,XML勧告に従って訂正することを
予定している。The XML Proposed Recommendation is superseded
by the XML Recommendation which was published by the World
Wide Web Consortium in February 1998. It is intended that
this &eTR-or-Rec; be revised accordingly in the near future.</p>
<p>この&TR-or-Rec;は,安定したものであって,昨年来の<loc
href='http://www.w3.org/XML'>XML活動</loc>を通じて作成された,一連の作
業草案を元とする。現在,広範囲に使用されている国際的なテキスト処理の標
準(標準一般化&markup;言語,Standard Generalized Markup Language, ISO
8879:1986に追加及び訂正を加えたもの)の,WWW上での使用のために&subset;
化した言語を,この&TR-or-Rec;は,規定する。ISO 8879のどの機能をこの
&subset;に残すか,という決定についての詳細は,<loc
href='http://www.w3.org/XML/#WG-decisions'>別途用意する</loc>。XMLは,
既にいくつかの商品でサポートされ,XMLをサポートする<loc
href='http://www.w3.org/XML/#software'>フリーウェア</loc>の数も増えて
いる。XMLに関する公開の論議も,オンラインで<loc
href='http://www.w3.org/XML/#discussion'>入手できる</loc>。It is a
stable document derived from a series of working drafts produced over
the last year as deliverables of the <loc
href='http://www.w3.org/XML'>XML activity</loc>. It specifies a
language created by subsetting an existing, widely used international
text processing standard (Standard Generalized Markup Language, ISO
8879:1986 as amended and corrected) for use on the World Wide Web.
Details of the decisions regarding which features of ISO 8879 to
retain in the subset <loc
href='http://www.w3.org/XML/#WG-decisions'>are available
separately</loc>. XML is already supported by some commercial
products, and there are a growing number of <loc
href='http://www.w3.org/XML/#software'>free implementations</loc>.
Public discussions of XML <loc
href='http://www.w3.org/XML/#discussion'>are accessible
online</loc>.</p>
<p>この&TR-or-Rec;では,<bibref ref="Berners-Lee"/>に定義する
URI(Uniform Resource Identifier)を使用する。URIの制定作業は進行中であっ
て,<bibref ref="RFC1738"/>及び<bibref ref="RFC1808"/>を更新する予定と
なっている。この作業がRFCとして受け入れられない場合は,この規程内のURI
への参照は,URL(Uniform Resource Locator)への参照に代わる。This
specification uses the term URI, which is defined by <bibref
ref="Berners-Lee"/>, a work in progress expected to update <bibref
ref="RFC1738"/> and <bibref ref="RFC1808"/>. Should the work not be
accepted as an RFC, the references to uniform resource identifiers
(URIs) in this specification will become references to uniform
resource locators (URLs).</p>
<p>XMLの仕様に準拠しているかどうかの基準となるはW3Cのサイトにあ
る原文である。The normative version of the specification is
the English version found at the W3C site.</p>
<p>この標準情報は原仕様と技術的に同一であることを意図しているが、
翻訳上の誤りはあり得る。Although this technical report is
intended to be technically identical to the original, it may
contain errors from the translation.</p>
<p>備考: 原規定との規定箇所の対応関係を明らかにするため、この
&TR-or-Rec;の節構成及び節番号は、原規定のそれらをできるだけ保存してい
る。この&TR-or-Rec;のWeb版は、原規定のHTMLタグをそのまま保存している。
</p>
</status>
<!-- out of date
<statusp>This is a W3C Working Draft for review by W3C members and other
interested parties. It is a draft document and may be updated,
replaced, or obsoleted by other documents at any time. It is
inappropriate to use W3C Working Drafts as reference material or to
cite them as other than "work in progress". A list of current W3C
working drafts can be found at
<loc href="http://www.w3.org/TR">http://www.w3.org/TR</loc>.</statusp>
<statusp><emph>Note:</emph> Since working drafts are subject to frequent
change, you are advised to reference the above URL, rather than the
URLs for working drafts themselves.</statusp>
<statusp>This work is part of the W3C SGML Activity (for current
status, see <loc href="http://www.w3.org/MarkUp/SGML/Activity"
>http://www.w3.org/MarkUp/SGML/Activity</loc>).</statusp>
<p>The current
draft of this specification
presupposes the successful completion of the current
work on the &WebSGML;, being prepared by ISO/IEC JTC1
at the time this draft specification was drafted.
If it is not
adopted in the expected form, some clauses of this specification
may change, and some
recommendations now labeled "<termref def="dt-interop">for
interoperability</termref>" will become requirements labeled
"<termref def="dt-compat">for compatibility</termref>".
</p>
<p>The current draft of this specification uses the term
URI, which is defined by
<bibref ref="Berners-Lee"/>,
which is work in progress expected to update
<bibref ref="RFC1738"/> and <bibref ref="RFC1808"/>.
Should the work in this draft not be accepted as an RFC, the
references to uniform resource identifiers (URIs) in this
specification will become references to uniform resource
locators (URLs).</p>
</status> -->
<abstract>
<p>拡張可能な&markup;言語(XML)はSGMLの簡単な方言であって,この&TR-or-Rec;で,そのすべてを規定する。XMLの目標は,現在のHTMLと同様に,一般性のあるSGMLをウェブ上で配布,受信及び処理できることとする。XMLは実装が容易であって,SGML及びHTMLのどちらに対しても相互運用性を保つ設計がなされている。</p>
</abstract>
<pubstmt>
<p>Chicago, Vancouver, Mountain View, et al.:
World-Wide Web Consortium, XML作業グループ, 1996, 1997.</p>
</pubstmt>
<sourcedesc>
<p>Created in electronic form.</p>
</sourcedesc>
<langusage>
<language id='EN'>English</language>
<language id='ebnf'>Extended Backus-Naur Form (formal grammar)</language>
</langusage>
<revisiondesc>
<slist>
<sitem>1997-12-03 : CMSMcQ : yet further changes</sitem>
<sitem>1997-12-02 : TB : further changes (see TB to XML WG,
2 December 1997)</sitem>
<sitem>1997-12-02 : CMSMcQ : deal with as many corrections and
comments from the proofreaders as possible:
entify hard-coded document date in pubdate element,
change expansion of entity WebSGML,
update status description as per Dan Connolly (am not sure
about refernece to Berners-Lee et al.),
add 'The' to abstract as per WG decision,
move Relationship to Existing Standards to back matter and
combine with References,
re-order back matter so normative appendices come first,
re-tag back matter so informative appendices are tagged informdiv1,
remove XXX XXX from list of 'normative' specs in prose,
move some references from Other References to Normative References,
add RFC 1738, 1808, and 2141 to Other References (they are not
normative since we do not require the processor to enforce any
rules based on them),
add reference to 'Fielding draft' (Berners-Lee et al.),
move notation section to end of body,
drop URIchar non-terminal and use SkipLit instead,
lose stray reference to defunct nonterminal 'markupdecls',
move reference to Aho et al. into appendix (Tim's right),
add prose note saying that hash marks and fragment identifiers are
NOT part of the URI formally speaking, and are NOT legal in
system identifiers (processor 'may' signal an error).
Work through:
Tim Bray reacting to James Clark,
Tim Bray on his own,
Eve Maler,
NOT DONE YET:
change binary / text to unparsed / parsed.
handle James's suggestion about &lt; in attriubte values
uppercase hex characters,
namechar list,
</sitem>
<sitem>1997-12-01 : JB : add some column-width parameters</sitem>
<sitem>1997-12-01 : CMSMcQ : begin round of changes to incorporate
recent WG decisions and other corrections:
binding sources of character encoding info (27 Aug / 3 Sept),
correct wording of Faust quotation (restore dropped line),
drop SDD from EncodingDecl,
change text at version number 1.0,
drop misleading (wrong!) sentence about ignorables and extenders,
modify definition of PCData to make bar on msc grammatical,
change grammar's handling of internal subset (drop non-terminal markupdecls),
change definition of includeSect to allow conditional sections,
add integral-declaration constraint on internal subset,
drop misleading / dangerous sentence about relationship of
entities with system storage objects,
change table body tag to htbody as per EM change to DTD,
add rule about space normalization in public identifiers,
add description of how to generate our name-space rules from
Unicode character database (needs further work!).
</sitem>
<sitem>1997-10-08 : TB : Removed %-constructs again, new rules
for PE appearance.</sitem>
<sitem>1997-10-01 : TB : Case-sensitive markup; cleaned up
element-type defs, lotsa little edits for style</sitem>
<sitem>1997-09-25 : TB : Change to elm's new DTD, with
substantial detail cleanup as a side-effect</sitem>
<sitem>1997-07-24 : CMSMcQ : correct error (lost *) in definition
of ignoreSectContents (thanks to Makoto Murata)</sitem>
<sitem>Allow all empty elements to have end-tags, consistent with
SGML TC (as per JJC).</sitem>
<sitem>1997-07-23 : CMSMcQ : pre-emptive strike on pending corrections:
introduce the term 'empty-element tag', note that all empty elements
may use it, and elements declared EMPTY must use it.
Add WFC requiring encoding decl to come first in an entity.
Redefine notations to point to PIs as well as binary entities.
Change autodetection table by removing bytes 3 and 4 from
examples with Byte Order Mark.
Add content model as a term and clarify that it applies to both
mixed and element content.
</sitem>
<sitem>1997-06-30 : CMSMcQ : change date, some cosmetic changes,
changes to productions for choice, seq, Mixed, NotationType,
Enumeration. Follow James Clark's suggestion and prohibit
conditional sections in internal subset. TO DO: simplify
production for ignored sections as a result, since we don't
need to worry about parsers which don't expand PErefs finding
a conditional section.</sitem>
<sitem>1997-06-29 : TB : various edits</sitem>
<sitem>1997-06-29 : CMSMcQ : further changes:
Suppress old FINAL EDIT comments and some dead material.
Revise occurrences of % in grammar to exploit Henry Thompson's pun,
especially markupdecl and attdef.
Remove RMD requirement relating to element content (?).
</sitem>
<sitem>1997-06-28 : CMSMcQ : Various changes for 1 July draft:
Add text for draconian error handling (introduce
the term Fatal Error).
RE deleta est (changing wording from
original announcement to restrict the requirement to validating
parsers).
Tag definition of validating processor and link to it.
Add colon as name character.
Change def of %operator.
Change standard definitions of lt, gt, amp.
Strip leading zeros from #x00nn forms.</sitem>
<sitem>1997-04-02 : CMSMcQ : final corrections of editorial errors
found in last night's proofreading. Reverse course once more on
well-formed: Webster's Second hyphenates it, and that's enough
for me.</sitem>
<sitem>1997-04-01 : CMSMcQ : corrections from JJC, EM, HT, and self</sitem>
<sitem>1997-03-31 : Tim Bray : many changes</sitem>
<sitem>1997-03-29 : CMSMcQ : some Henry Thompson (on entity handling),
some Charles Goldfarb, some ERB decisions (PE handling in miscellaneous
declarations. Changed Ident element to accept def attribute.
Allow normalization of Unicode characters. move def of systemliteral
into section on literals.</sitem>
<sitem>1997-03-28 : CMSMcQ : make as many corrections as possible, from
Terry Allen, Norbert Mikula, James Clark, Jon Bosak, Henry Thompson,
Paul Grosso, and self. Among other things: give in on "well formed"
(Terry is right), tentatively rename QuotedCData as AttValue
and Literal as EntityValue to be more informative, since attribute
values are the <emph>only</emph> place QuotedCData was used, and
vice versa for entity text and Literal. (I'd call it Entity Text,
but 8879 uses that name for both internal and external entities.)</sitem>
<sitem>1997-03-26 : CMSMcQ : resynch the two forks of this draft, reapply
my changes dated 03-20 and 03-21. Normalize old 'may not' to 'must not'
except in the one case where it meant 'may or may not'.</sitem>
<sitem>1997-03-21 : TB : massive changes on plane flight from Chicago
to Vancouver</sitem>
<sitem>1997-03-21 : CMSMcQ : correct as many reported errors as possible.
</sitem>
<sitem>1997-03-20 : CMSMcQ : correct typos listed in CMSMcQ hand copy of spec.</sitem>
<sitem>1997-03-20 : CMSMcQ : cosmetic changes preparatory to revision for
WWW conference April 1997: restore some of the internal entity
references (e.g. to docdate, etc.), change character xA0 to &amp;nbsp;
and define nbsp as &amp;#160;, and refill a lot of paragraphs for
legibility.</sitem>
<sitem>1996-11-12 : CMSMcQ : revise using Tim's edits:
Add list type of NUMBERED and change most lists either to
BULLETS or to NUMBERED.
Suppress QuotedNames, Names (not used).
Correct trivial-grammar doc type decl.
Rename 'marked section' as 'CDATA section' passim.
Also edits from James Clark:
Define the set of characters from which [^abc] subtracts.
Charref should use just [0-9] not Digit.
Location info needs cleaner treatment: remove? (ERB
question).
One example of a PI has wrong pic.
Clarify discussion of encoding names.
Encoding failure should lead to unspecified results; don't
prescribe error recovery.
Don't require exposure of entity boundaries.
Ignore white space in element content.
Reserve entity names of the form u-NNNN.
Clarify relative URLs.
And some of my own:
Correct productions for content model: model cannot
consist of a name, so "elements ::= cp" is no good.
</sitem>
<sitem>1996-11-11 : CMSMcQ : revise for style.
Add new rhs to entity declaration, for parameter entities.</sitem>
<sitem>1996-11-10 : CMSMcQ : revise for style.
Fix / complete section on names, characters.
Add sections on parameter entities, conditional sections.
Still to do: Add compatibility note on deterministic content models.
Finish stylistic revision.</sitem>
<sitem>1996-10-31 : TB : Add Entity Handling section</sitem>
<sitem>1996-10-30 : TB : Clean up term &amp; termdef. Slip in
ERB decision re EMPTY.</sitem>
<sitem>1996-10-28 : TB : Change DTD. Implement some of Michael's
suggestions. Change comments back to //. Introduce language for
XML namespace reservation. Add section on white-space handling.
Lots more cleanup.</sitem>
<sitem>1996-10-24 : CMSMcQ : quick tweaks, implement some ERB
decisions. Characters are not integers. Comments are /* */ not //.
Add bibliographic refs to 10646, HyTime, Unicode.
Rename old Cdata as MsData since it's <emph>only</emph> seen
in marked sections. Call them attribute-value pairs not
name-value pairs, except once. Internal subset is optional, needs
'?'. Implied attributes should be signaled to the app, not
have values supplied by processor.</sitem>
<sitem>1996-10-16 : TB : track down &amp; excise all DSD references;
introduce some EBNF for entity declarations.</sitem>
<sitem>1996-10-?? : TB : consistency check, fix up scraps so
they all parse, get formatter working, correct a few productions.</sitem>
<sitem>1996-10-10/11 : CMSMcQ : various maintenance, stylistic, and
organizational changes:
Replace a few literals with xmlpio and
pic entities, to make them consistent and ensure we can change pic
reliably when the ERB votes.
Drop paragraph on recognizers from notation section.
Add match, exact match to terminology.
Move old 2.2 XML Processors and Apps into intro.
Mention comments, PIs, and marked sections in discussion of
delimiter escaping.
Streamline discussion of doctype decl syntax.
Drop old section of 'PI syntax' for doctype decl, and add
section on partial-DTD summary PIs to end of Logical Structures
section.
Revise DSD syntax section to use Tim's subset-in-a-PI
mechanism.</sitem>
<sitem>1996-10-10 : TB : eliminate name recognizers (and more?)</sitem>
<sitem>1996-10-09 : CMSMcQ : revise for style, consistency through 2.3
(Characters)</sitem>
<sitem>1996-10-09 : CMSMcQ : re-unite everything for convenience,
at least temporarily, and revise quickly</sitem>
<sitem>1996-10-08 : TB : first major homogenization pass</sitem>
<sitem>1996-10-08 : TB : turn "current" attribute on div type into
CDATA</sitem>
<sitem>1996-10-02 : TB : remould into skeleton + entities</sitem>
<sitem>1996-09-30 : CMSMcQ : add a few more sections prior to exchange
with Tim.</sitem>
<sitem>1996-09-20 : CMSMcQ : finish transcribing notes.</sitem>
<sitem>1996-09-19 : CMSMcQ : begin transcribing notes for draft.</sitem>
<sitem>1996-09-13 : CMSMcQ : made outline from notes of 09-06,
do some housekeeping</sitem>
</slist>
</revisiondesc>
</header>
<body>
<div1 id='sec-intro'>
<head>一般事項</head>
<!-- <div2 id='sec-scope'>
<head>適用範囲</head> -->
<p>拡張可能な&markup;言語XML(eXtensible Markup Language)は,<termref def="dt-xml-doc">XML文書</termref>というデータオブジェクトのクラスを規定し,XML文書を処理するプログラムの動作の一部を規定する。XMLは,SGML(標準一般化&markup;言語,Standard Generalized Markup Language)<bibref ref='ISO8879'/>の制限した&subset;とする。構造上,XML文書は,かならずSGML規格に適合する。</p>
<p>XML文書は,<termref def="dt-entity">実体</termref>という記憶単位からなり,実体は,&parsed-data;又は&unparsed-data;からなる。&parsed-data;は,<termref def="dt-character">文字</termref>からなり,その一部は,文書の<termref def="dt-chardata">文字データ</termref>を構成し,一部は,<termref def="dt-markup">&markup;</termref>を構成する。&markup;は,文書の記憶レイアウト及び論理構造についての記述を表す符号とする。XMLは,記憶レイアウト及び論理構造についての制約条件を記述する機構を提供する。</p>
<p><termdef id="dt-xml-proc" term="XML&processor;"><term>XML&processor;</term>というソフトウェアモジュールは,XML文書を読み込み,その内容及び構造へのアクセスを提供するために用いる。 </termdef> <termdef id="dt-app" term="&application;">XML&processor;は,他のモジュールのために動作することを前提とし,そのモジュールを<term>&application;</term>という。</termdef>この&TR-or-Rec;は,XML&processor;が行わなければならない振舞いを規定する。つまり,XMLデータの読込み方法を規定し,&application;に提供する情報を規定する。</p>
<!-- </div2> -->
<div2 id='sec-origin-goals'>
<head>経緯及び目標</head>
<p>1996年にWorld Wide Web Consortium(W3C)の中に設立したXML作業グループ(以前は, SGML編集レビュー委員会と呼ばれた)が,XMLを開発した。この作業グループの議長を,Sun MicrosystemsのJon Bosakが勤める。W3Cが組織し,以前はSGML作業グループと呼ばれたXML SIG(Special Interest Group)も,XMLの制定に非常に活発に参画した。
<!--JISでは? XML作業グループのメンバを付録に示す。-->Dan Connollyは,作業グループのW3Cにおける連絡係を務めた。</p>
<p>XMLの設計目標を,次に示す。<ulist>
<item><p>a) XMLは,Internet上でそのまま使用できる。</p></item>
<item><p>b) XMLは,広範囲の&application;を支援する。</p></item>
<item><p>c) XMLは,SGMLと互換性をもつ。</p></item>
<item><p>d) XML文書を処理するプログラムを書くことは,容易でなければならない。</p></item>
<item><p>e) XMLでは,オプションの機能はできるだけ少なくし,一つも存在しないことを目指す。</p></item>
<item><p>f) XML文書は,人間にとって読みやすく,十分に理解しやすい。</p></item>
<item><p>g) XMLの設計は,すみやかに行えなければならない。</p></item>
<item><p>h) XMLの設計は,厳密及び簡潔でなければならない。</p></item>
<item><p>i) XML文書は,容易に作成できる。</p></item>
<item><p>j) XMLでは,&markup;の数を減らすことは,重要ではない。</p></item></ulist>
</p>
<p>XML第&XML.version;&version;を理解し,それを処理する計算機プログラムを書くために十分な情報は,この&TR-or-Rec;及び関連する規格(文字用として,Unicode及びISO/IEC 10646,<!--* XXX for Uniform Resource Identifiers, *-->&language-identification;タグ用として,インタネット RFC 1766,&language-code;用として,ISO 639,並びに&country-code;用として,ISO 3166)で,すべて示す。</p>
<p>この&version;のXMLの規定<!-- (&doc.date;) -->は,公開レビュー及び議論を目的とする。テキスト及び法律上の注意を改変しない限り,自由に配布してもよい。</p>
</div2>
<div2 id='sec-terminology'>
<head>定義</head>
<p>XML文書の規定のために使用する用語は,この&TR-or-Rec;内で定義する。次に示す語句は,それらの用語を定義するため,及びXML&processor;の動きを規定するために使用する。
<glist>
<gitem>
<label>1.2.1 してもよい(may)</label>
<def><p><termdef id="dt-may" term="してもよい">適合する文書又はXML&processor;は,記述されたとおりに動作してもよいが,そのとおりにする必要はない。</termdef></p></def>
</gitem>
<gitem>
<label>1.2.2 しなければならない(must)</label>
<def><p>適合する文書又はXML&processor;は,記述されたとおりに動作することが要求される。そうでなければ,&error;とする。<!-- do NOT change this! this is what defines a violation ofa 'must' clause as 'an error'. -MSM -->
</p></def>
</gitem>
<gitem>
<label>1.2.3 &error;(error)</label>
<def><p><termdef id="dt-error" term="&error;">この&TR-or-Rec;が定める規則に対する違反。結果は定義しない。適合するソフトウェアは,&error;を検出して報告してもよく,&error;から回復してもよい。</termdef></p></def>
</gitem>
<gitem>
<label>1.2.4 &fatal-error;(fatal error)</label>
<def><p><termdef id="dt-fatal" term="&fatal-error;">適合する<termref def="dt-xml-proc">XML&processor;</termref>が検出しなければならず,&application;に報告しなければならない&error;。&fatal-error;を発見したあと,&processor;は,それ以降の&error;を探すためにデータ処理を続行してもよく,&error;を発見した場合は,その&error;を&application;に報告してもよい。&error;訂正をサポートするために,&processor;は,未処理データ(文字データ及び&markup;の混在したもの)を文書から取り出し,&application;に渡してもよい。しかし,一度,&fatal-error;を検出したら,&processor;は,通常の処理を続行してはならない。つまり,&processor;は,文字データ及び文書の論理構造についての情報を,通常の方法で&application;に渡し続けてはならない。</termdef></p></def>
</gitem>
<gitem>
<label>1.2.5 &at-user-option;(at user option)</label>
<def><p>適合するソフトウエアは,記述されたとおりに振る舞ってもよい(may),又は振る舞わなくてはならない(must)(文章中の助動詞による。)。そのとおりに振る舞う場合は,記述された振舞いを選択又は拒否する手段を&user;に提供しなければならない。</p></def>
</gitem>
<gitem>
<label>1.2.6 &validity;制約(validity constraint)</label>
<def><p>すべての<termref def="dt-valid">&valid;な</termref>XML文書に適用する規則。&validity;制約の違反は,&error;とする。&at-user-option;,<termref def="dt-validating">検証を行うXML&processor;</termref>は,この&error;を報告しなければならない。</p></def>
</gitem>
<gitem>
<label>1.2.7 &well-formed;制約(well-formedness constraint)</label>
<def><p>すべての<termref def="dt-wellformed">&well-formed;</termref>のXML文書に適用する規則。&well-formed;制約の違反は,<termref def="dt-fatal">&fatal-error;</termref>とする。</p></def>
</gitem>
<gitem>
<label>1.2.8 &match;(match)</label>
<def><p>a) <termdef id="dt-match" term="&match;">&string;又は名前の&match; 比較する二つの&string;又は名前は,同一でなければならない。ISO/IEC 10646において,複数の表現が可能な文字[例えば,&composed-form;及び基底+&diacritical-mark;(ダイアクリティカルマーク)形式]は,どちらの&string;も同じ表現のときに限り,&match;する。&at-user-option;,&processor;は,その文字を標準形に正規化してもよい。比較のとき、大文字と小文字との区別をする。<!-- Note that no processing of characters with respect to case is part of the matching process. -->&lt;BR>b) &string;と文法中の規則との&match; ある生成規則から生成する言語に,ある&string;が属するとき,この&string;は,この生成規則に&match;するという。&lt;BR>c) 内容と内容モデルとの&match; ある要素が,<titleref href='elementvalid'>要素の&validity;</titleref>の制約に示す意味で適合するとき,この要素は,その宣言に&match;するという。</termdef></p></def>
</gitem>
<gitem>
<label>1.2.9 互換性のため(for compatibility)</label>
<def><p><termdef id="dt-compat" term="互換性のため">XMLの機能であって,XMLがSGMLと互換であることを保証するためだけに導入されるもの。</termdef></p></def>
</gitem>
<gitem>
<label>1.2.10 相互運用性のため(for interoperability)</label>
<def><p><termdef id="dt-interop" term="相互運用性のため">拘束力はもたない推奨事項。&WebSGML;以前から存在するSGML&processor;が,XML文書を処理できる可能性を高めるために取り入れるもの。</termdef></p></def>
</gitem>
</glist>
</p>
</div2>
</div1>
<!-- &Docs; -->
<div1 id='sec-documents'>
<head>文書</head>
<p><termdef id="dt-xml-doc" term="XML文書">
<!-- A textual object -->
この&TR-or-Rec;で定義する意味で,<termref def="dt-wellformed">&well-formed;</termref>とするデータオブジェクトを,<term>XML文書</term>という。&well-formed;のXML文書が,さらに,ある制約条件を満足すれば,<termref def="dt-valid">&valid;</termref>なXML文書とする。
</termdef></p>
<!-- why this div? -TB
<div2 id='sec-log-phys'>
<head>Logical and Physical Structure</head> -->
<p>いずれのXML文書も,論理構造及び物理構造をもつ。物理的には,文書は,<termref def="dt-entity">実体</termref>と呼ぶ単位からなる。ある実体は,文書内に他の実体を含むために,その他の実体を<termref def="dt-entref">参照</termref>してもよい。文書は,“ルート”すなわち<termref def="dt-docent">文書実体</termref>から始まる。論理的には,文書は,宣言,要素,コメント,文字参照及び処理命令を含み,これらすべては,文書内で明示的な&markup;によって示す。論理構造及び物理構造は,<titleref href="wf-entities">以降</titleref>に示すとおりに,厳密に入れ子になっていなければならない。</p>
<!--
</div2> -->
<div2 id='sec-well-formed'>
<head>&well-formed;のXML文書</head>
<p><termdef id="dt-wellformed" term="&well-formed;">あるテキストオブジェクトが,次のいずれかのとき,そのテキストオブジェクトを&well-formed;のXML文書と呼ぶ。</termdef>
<ulist>
<item><p>a) 全体として,<nt def='NT-document'>document</nt>というラベルをもつ生成規則に&match;する。</p></item>
<item><p>b) この&TR-or-Rec;で定義する,すべての&well-formed;制約に従う。</p>
</item>
<item><p>c) それぞれの<termref def='dt-parsedent'>&parsed-entity;</termref>が,<titleref href='wf-entities'>&well-formed;</titleref>となる。</p></item>
</ulist></p>
<p>
<scrap lang='ebnf' id='document'>
<head>文書</head>
<prod id='NT-document'><lhs>document</lhs>
<rhs><nt def='NT-prolog'>prolog</nt>
<nt def='NT-element'>element</nt>
<nt def='NT-Misc'>Misc</nt>*</rhs></prod>
</scrap>
</p>
<p><nt def="NT-document">document</nt>生成規則に&match;するとは,次を意味する。
<ulist>
<item><p>a) 一つ以上の<termref def="dt-element">要素</termref>を含む。</p>
</item>
<!--* N.B. some readers (notably JC) find the following
paragraph awkward and redundant. I agree it's logically redundant:
it *says* it is summarizing the logical implications of
matching the grammar, and that means by definition it's
logically redundant. I don't think it's rhetorically
redundant or unnecessary, though, so I'm keeping it. It
could however use some recasting when the editors are feeling
stronger. -MSM *-->
<item><p>b) <termdef id="dt-root" term="ルート要素"><term>ルート</term>又は文書要素という要素が一つだけ存在し,これは,他の要素の<termref def="dt-content">内容</termref>に含まれない。</termdef>これ以外のすべての要素は,その開始タグが他の要素の内容に含まれれば,対応する終了タグも同じ要素の内容に含まれる。つまり,要素は,開始タグ及び終了タグによって区切られ,入れ子構造をなす。
</p></item>
</ulist>
</p>
<p><termdef id="dt-parentchild" term="親要素/子要素">これらの結果として,文書内のどの非ルート要素<code>C</code>に対しても,ある他の要素<code>P</code>が存在し,<code>C</code>は,<code>P</code>の内容に含まれるが,<code>P</code>の内容に含まれる他の要素に含まれることはない。このとき,<code>P</code><code>C</code><code></code>といい,<code>C</code><code>P</code><code></code>という。</termdef></p>
</div2>
<div2 id="charsets">
<head>文字</head>
<p>
<!--The data stored in an XML <termref def="dt-entity">entity</termref> is
either <termref def="dt-text">parsed</termref> or <termref
def="dt-unparsed">unparsed</termref>. -->
<termdef id="dt-text" term="テキスト">&parsed-entity;は,<term>テキスト</term>(<termref def="dt-character">文字</termref>の並びであって,&markup;又は文字データを表してもよい。)を含む。</termdef><termdef id="dt-character" term="文字"><term>文字</term>は,テキストの最小単位であって,ISO/IEC 10646<bibref ref="ISO10646"/>に規定される。<!--Users may extend the ISO/IEC 10646 character repertoire by exploiting the private use areas. -->許容する文字は,タブ,改行,復帰並びにUnicode及びISO/IEC 10646が許容する図形文字とする。</termdef>
<scrap lang="ebnf" id="char32">
<head>文字の範囲</head>
<prodgroup pcw2="4" pcw4="17.5" pcw5="11">
<prod id="NT-Char"><lhs>Char</lhs>
<rhs>#x9 | #xA | #xD | [#x20-#D7FF] | [#xE000-#xFFFD]
| [#x10000-#x10FFFF]</rhs>
<com>任意のUnicode文字。ただし,&surrogate-blocks;,FFFE及びFFFFは除く。</com>
</prod>
</prodgroup>
</scrap>
</p>
<p>&character-value;をビットパタンに符号化する機構は,実体ごとに違ってもよい。すべてのXML&processor;は,ISO/IEC 10646のUTF-8符号化及びUTF-16符号化を受け付けなければならない。二つのどちらが用いられているかを明示するための機構,及び他の符号化方法を利用するための機構は,<titleref href='charencoding'>文字の符号化</titleref>に記述する。</p>
<p>どの符号化方法を用いるかに関係なく,ISO/IEC 10646の文字集合にあるすべての文字は,そのUCS-4&code-value;<!-- bit string. -->と等価な10進数又は16進数によって,参照できる。</p>
</div2>
<div2 id='sec-common-syn'>
<head>共通の構文構成子</head>
<p>2.3では,文法内で広く使用するいくつかの記号を定義する。</p>
<p><nt def="NT-S">S</nt> (空白)は,一つ若しくは複数の&space-character;(#x20),復帰,改行又はタブから成る。
<scrap lang="ebnf" id='white'>
<head>空白</head>
<prodgroup pcw2="4" pcw4="17.5" pcw5="11">
<prod id='NT-S'><lhs>S</lhs>
<rhs>(#x20 | #x9 | #xD | #xA)+</rhs>
</prod>
</prodgroup>
</scrap></p>
<p>便宜上,文字を,&letter;,数字又は他の文字に分類する。&letter;は,アルファベット的又は表音的である基本文字(一つ又は複数の&combining-character;が,後に続くこともある。),&ideographic;から成る。
<!--
Certain layout and format-control characters defined by ISO/IEC 10646
should be ignored when recognizing identifiers; these are defined by the
classes <nt def='NT-Ignorable'>Ignorable</nt> and <nt def='NT-
Extender'>Extender</nt>.
-->
各クラスにおける実際の文字についての完全な定義は,<titleref href='CharClasses'>文字クラス</titleref>に関する付録に規定する。</p>
<p><termdef id="dt-name" term="Name"><term>Name</term>は,&letter;又はいくつかの区切り文字の一つで始まり,その後に&letter;,数字,ハイフン,下線,コロン又はピリオドが続く(これらを名前文字という。)。</termdef>&string;"<code>xml</code>"又は<code>(('X'|'x') ('M'|'m') ('L'|'l'))</code>に&match;する任意の&string;で始まる名前は,この&TR-or-Rec;の現在の版又は将来の版での標準化のために予約する。
</p>
<note>
<p>XMLの名前の中のコロンは,名前空間での実験のために予約する。コロンの意味は,将来のある時点で標準化するものとし,そのときには,実験的な目的でコロンを使用する文書を更新する必要が生じる可能性がある。XMLで採用する名前空間の機構が,区切り子として実際にコロンを使用するという保証はない。事実上,これは,名前空間の実験の一つとして以外には,XMLの名前の中でコロンを使用しないほうがよいことを意味する。しかし,XML&processor;は,名前文字としてコロンを受け付けることが望ましい。
</p>
</note>
<p>
<nt def='NT-Nmtoken'>Nmtoken</nt> (名前&token;)は,名前文字で構成する列とする。
<scrap lang='ebnf'>
<head>名前及び&token;</head>
<!--
<prod id='NT-MiscName'><lhs>MiscName</lhs>
<rhs></rhs>
</prod>-->
<prod id='NT-NameChar'><lhs>NameChar</lhs>
<rhs><nt def="NT-Letter">Letter</nt>
| <nt def='NT-Digit'>Digit</nt>
<!--| <nt def='NT-MiscName'>MiscName</nt>-->
| '.' | '-' | '_' | ':'
| <nt def='NT-CombiningChar'>CombiningChar</nt>
<!-- | <nt def='NT-Ignorable'>Ignorable</nt> -->
| <nt def='NT-Extender'>Extender</nt></rhs>
</prod>
<prod id='NT-Name'><lhs>Name</lhs>
<rhs>(<nt def='NT-Letter'>Letter</nt> | '_' | ':')
(<nt def='NT-NameChar'>NameChar</nt>)*</rhs></prod>
<prod id='NT-Names'><lhs>Names</lhs>
<rhs><nt def='NT-Name'>Name</nt>
(<nt def='NT-S'>S</nt> <nt def='NT-Name'>Name</nt>)*</rhs></prod>
<prod id='NT-Nmtoken'><lhs>Nmtoken</lhs>
<rhs>(<nt def='NT-NameChar'>NameChar</nt>)+</rhs></prod>
<prod id='NT-Nmtokens'><lhs>Nmtokens</lhs>
<rhs><nt def='NT-Nmtoken'>Nmtoken</nt> (<nt def='NT-S'>S</nt> <nt
def='NT-Nmtoken'>Nmtoken</nt>)*</rhs></prod>
</scrap>
</p>
<p>&literal;データは,引用符で囲まれた&string;とし,その列の区切り子として使用する引用符は含まない。&literal;は,内部実体(<nt def='NT-EntityValue'>EntityValue</nt>),属性値(<nt def='NT-AttValue'>AttValue</nt>),外部&identifier;(<nt def="NT-SystemLiteral">SystemLiteral</nt>)の内容の指定に使用する。目的によっては,&literal;全体を,その中の&markup;の走査を行なわずに,スキップすることがある(<nt def='NT-SkipLit'>SkipLit</nt>。)。
<scrap lang='ebnf'>
<head>&literal;</head>
<!-- is marked section end legal in entity values etc.?
James says yes. Handbook page 392, sec. 10.4 seems to me to say no.
If James is right, leave as is. Otherwise, uncomment
the next comment and ...
-->
<!--
<prod id='NT-EntityValue'><lhs>EntityValue</lhs>
<rhs>' " '
(([^%&amp;"]
| <nt def='NT-PEReference'>PEReference</nt>
| <nt def='NT-Reference'>Reference</nt>)*
- (<nt def='NT-Char'>Char</nt>* ']]&gt;' <nt def='NT-char'>Char</nt>*))
' " '
</rhs>
<rhs>|&nbsp;
" ' "
(([^%&amp;']
| <nt def='NT-PEReference'>PEReference</nt>
| <nt def='NT-Reference'>Reference</nt>)*
- (<nt def='NT-Char'>Char</nt>* ']]&gt;' <nt def='NT-char'>Char</nt>*))
" ' "</rhs>
</prod>
<prod id='NT-AttValue'><lhs>AttValue</lhs>
<rhs>'"'
(([^&lt;&amp;"]
| <nt def='NT-Reference'>Reference</nt>)*
- (<nt def='NT-Char'>Char</nt>* ']]&gt;' <nt def='NT-char'>Char</nt>*))
' " '
</rhs>
<rhs>|&nbsp;
" ' "
(([^&lt;&amp;']
| <nt def='NT-Reference'>Reference</nt>)*
- (<nt def='NT-Char'>Char</nt>* ']]&gt;' <nt def='NT-char'>Char</nt>*))
" ' "</rhs>
<wfc def="CleanAttrVals"/>
</prod>
-->
<!-- ... and comment out the following, down to ... -->
<prod id='NT-EntityValue'><lhs>EntityValue</lhs>
<rhs>' " '
([^%&amp;"]
| <nt def='NT-PEReference'>PEReference</nt>
| <nt def='NT-Reference'>Reference</nt>)*
' " '
</rhs>
<rhs>|&nbsp;
" ' "
([^%&amp;']
| <nt def='NT-PEReference'>PEReference</nt>
| <nt def='NT-Reference'>Reference</nt>)*
" ' "</rhs>
</prod>
<prod id='NT-AttValue'><lhs>AttValue</lhs>
<rhs>' " '
([^&lt;&amp;"]
| <nt def='NT-Reference'>Reference</nt>)*
' " '
</rhs>
<rhs>|&nbsp;
" ' "
([^&lt;&amp;']
| <nt def='NT-Reference'>Reference</nt>)*
" ' "</rhs>
<!--<wfc def="WF-Attvaldelim"/>-->
</prod>
<!-- ... down to here. -->
<prod id="NT-SystemLiteral"><lhs>SystemLiteral</lhs>
<rhs><nt def='NT-SkipLit'>SkipLit</nt></rhs>
</prod>
<!-- <prod id="NT-URIchar"><lhs>URIchar</lhs>
<rhs><com>See <loc href="http://www.w3.org/XXX">XXX</loc></com>
</rhs></prod>
-->
<prod id="NT-PubidLiteral"><lhs>PubidLiteral</lhs>
<rhs>' " ' <nt def='NT-PubidChar'>PubidChar</nt>*
' " '
| " ' " (<nt def='NT-PubidChar'>PubidChar</nt> - " ' ")* " ' "</rhs>
</prod>
<prod id="NT-PubidChar"><lhs>PubidChar</lhs>
<rhs>#x20 | #xD | #xA
|&nbsp;[a-zA-Z0-9]
|&nbsp;[-'()+,./:=?]</rhs>
</prod>
<prod id="NT-SkipLit"><lhs>SkipLit</lhs>
<rhs>(' " ' [^"]* ' " ')
|&nbsp;(" ' " [^']* " ' ")</rhs>
</prod>
<!-- alternate form, making ms end illegal: -->
<!--
<prod id="NT-SkipLit"><lhs>SkipLit</lhs>
<rhs>(' " ' ([^"]* - ([^"]* ']]&gt;' [^"]*)) ' " ')
|&nbsp;(" ' " ([^']* - ([^']* ']]&gt;' [^']*)) " ' ")</rhs>
</prod>
-->
</scrap>
</p>
<!--
<wfcnote id="WF-Attvaldelim">
<head>Delimiters in Attribute Values</head>
<p>After the expansion of character and entity references,
an attribute value must not contain a "<code>&lt;</code>"
or "<code>&amp;</code>" character unless that character was
introduced by the expansion of a character reference
or one of the entities &magicents;.</p>
</wfcnote>-->
<!--
This is not quite right: &lt; should be legal, should it not?
Suppress this WFC until we get it right.
-->
<!-- Henry Thompson suggests (in substance, not form: the wording needs
to be clarified):
"Cooked Attribute values must not contain &lt; &amp; or the
quote which closed their uncooked literal,
unless arising from the expansion of a character reference or
magic reference
directly contained in their uncooked literal."
I'm not sure I agree with this rule, but it's at least coherent,
which is more than I can say for my attempt.
-->
</div2>
<div2 id='syntax'>
<head>文字データ及び&markup;</head>
<p><termref def='dt-text'>テキスト</termref>は,<termref def="dt-chardata">文字データ</termref>及び&markup;が混在するものとして構成する。<termdef id="dt-markup" term="Markup"><term>&markup;</term>は,<termref def="dt-stag">開始タグ</termref><termref def="dt-etag">終了タグ</termref><termref def="dt-empty">空要素</termref><termref def="dt-entref">実体参照</termref><termref def="dt-charref">文字参照</termref><termref def="dt-comment">コメント</termref><termref def="dt-cdsection">CDATAセクション</termref> の区切り子,<termref def="dt-doctype">文書型宣言</termref>及び<termref def="dt-pi">処理命令</termref>の形を取る。
</termdef>
</p>
<p><termdef id="dt-chardata" term="Character Data">&markup;ではないすべてのテキストは,文書の<term>文字データ</term>を構成する。</termdef></p>
<p>アンパサンド文字 (&amp;)及び&left-angle-bracket; (&lt;)は,&markup;の区切り子として,又は<termref def="dt-comment">コメント</termref><termref def="dt-pi">処理命令</termref>若しくは<termref def="dt-cdsection">CDATAセクション</termref>内で使用する場合に<emph>だけ</emph>,そのままの形で出現してよい。これらの文字は,内部実体宣言の<termref def='dt-litentval'>&literal;実体値</termref>内に記述してもよい。 詳しくは,<titleref href='wf-entities'>&well-formed;の実体</titleref>に関する規定を参照。<!-- FINAL EDIT: restore internal entity decl or leave it out. -->これらの文字が他の部分で必要な場合,数値による文字参照又は&string;"<code>&amp;amp;</code>"及び&string;"<code>&amp;lt;</code>"を使用し,<termref def="dt-escape">&escape;</termref>しなければならない。&right-angle-bracket; (>) は,&string;"<code>&amp;gt;</code>"を使用して表現してもよい。内容の中で列"<code>]]&gt;</code>"を使用するときは,それが,<termref def="dt-cdsection">CDATAセクション</termref>の終了を&markup;しない限り,<termref def='dt-compat'>互換性のため</termref>,"<code>&amp;gt;</code>"又は文字参照を使用し,&escape;しなければならない。</p>
<p>要素の内容では,文字データは,いかなる&markup;の開始区切り子を含まない任意の&char-string;とする。CDATAセクションでは,文字データとは,CDATAセクションの終了区切り子"<code>]]&gt;</code>"を含まない任意の&char-string;とする。
</p>
<p>
属性値に&single-quote;及び&double-quote;を含むためには,アポストロフィ又は&single-quote;(') は,"<code>&amp;apos;</code>"として表現し,&double-quote;(")は,"<code>&amp;quot;</code>"として表現する。
<scrap lang="ebnf">
<head>文字データ</head>
<prod id='NT-CharData'>
<lhs>CharData</lhs>
<rhs>[^&lt;&amp;]* - ([^&lt;&amp;]* ']]&gt;' [^&lt;&amp;]*)</rhs>
</prod>
</scrap>
</p>
</div2>
<div2 id='sec-comments'>
<head>コメント</head>
<p><termdef id="dt-comment" term="Comment"><term>コメント</term>は,他の<termref def='dt-markup'>&markup;</termref>の外ならば,文書のどこに現れてもよい。さらに,文書型宣言内で,文法が許す場所に現れてもよい。
<!-- TB
except in a <termref def="dt-cdsection">CDATA section</termref>, i.e. within
<termref def="dt-elemcontent">element content</termref>, in
<termref def="dt-mixed">mixed content</termref>, or in the prolog. They must
not occur within declarations or tags. -->
コメントは,文書の<termref def="dt-chardata">文字データ</termref>の一部ではない。XML&processor;は,&application;がコメントのテキストを取り出すことを可能としてもよいが,そうしなくともよい。
<termref def="dt-compat">互換性のため</termref>,&string;"<code>--</code>" (&double-hyphen;)は,コメント内で現れてはならない。
<scrap lang="ebnf">
<head>コメント</head>
<prod id='NT-Comment'><lhs>Comment</lhs>
<rhs>'&lt;!--'
((<nt def='NT-Char'>Char</nt> - '-')
| ('-' (<nt def='NT-Char'>Char</nt> - '-')))*
'-->'</rhs>
<!--
<rhs>'&lt;!&como;'
(<nt def='NT-Char'>Char</nt>* -
(<nt def='NT-Char'>Char</nt>* '&comc;' <nt def='NT-Char'>Char</nt>*))
'&comc;&gt;'</rhs> -->
</prod>
</scrap>
</termdef></p>
<p>コメントの例を次に示す。
<eg>&lt;!&como; declarations for &lt;head> &amp; &lt;body> &comc;&gt;</eg>
</p>
</div2>
<div2 id='sec-pi'>
<head>処理命令</head>
<p><termdef id="dt-pi" term="Processing instruction"><term>処理命令</term>(PI)によって,&application;のための命令を文書に入れることができる。
<scrap lang="ebnf">
<head>処理命令</head>
<prod id='NT-PI'><lhs>PI</lhs>
<rhs>'&lt;?' <nt def='NT-PITarget'>PITarget</nt>
(<nt def='NT-S'>S</nt>
(<nt def='NT-Char'>Char</nt>* -
(<nt def='NT-Char'>Char</nt>* &pic; <nt def='NT-Char'>Char</nt>*)))?
&pic;</rhs></prod>
<prod id='NT-PITarget'><lhs>PITarget</lhs>
<rhs><nt def='NT-Name'>Name</nt> -
(('X' | 'x') ('M' | 'm') ('L' | 'l'))</rhs>
</prod>
</scrap></termdef>
PIは,文書の<termref def="dt-chardata">文字データ</termref>の一部ではないが,&application;に渡されなければならない。PIは,命令が渡される&application;を&identify;ために使用する&target; (<nt def='NT-PITarget'>PITarget</nt>) で始まる。&target;名 "<code>XML</code>","<code>xml</code>"などは,この&TR-or-Rec;の現在の版又は将来の版の規格化用に予約する。XMLの<termref def='dt-notation'>記法</termref>機構を,PIの&target;を宣言するために使用してもよい。
</p>
</div2>
<div2 id='sec-cdata-sect'>
<head>CDATAセクション</head>
<p><termdef id="dt-cdsection" term="CDATA Section"><term>CDATAセクション</term>は,文字データが出現するところであれば,どこに出現してもよい。これは,そうでなければ,&markup;として認識する文字を含む,テキストの区画を&escape;するのに使用する。CDATAセクションは,&string;"<code>&lt;![CDATA[</code>"で始まり,&string;
"<code>]]&gt;</code>"で終わる。
<scrap lang="ebnf">
<head>CDATAセクション</head>
<prod id='NT-CDSect'><lhs>CDSect</lhs>
<rhs><nt def='NT-CDStart'>CDStart</nt>
<nt def='NT-CData'>CData</nt>
<nt def='NT-CDEnd'>CDEnd</nt></rhs></prod>
<prod id='NT-CDStart'><lhs>CDStart</lhs>
<rhs>'&lt;![CDATA['</rhs>
</prod>
<prod id='NT-CData'><lhs>CData</lhs>
<rhs>(<nt def='NT-Char'>Char</nt>* -
(<nt def='NT-Char'>Char</nt>* ']]&gt;' <nt def='NT-Char'>Char</nt>*))
</rhs>
</prod>
<prod id='NT-CDEnd'><lhs>CDEnd</lhs>
<rhs>']]&gt;'</rhs>
</prod>
</scrap>
CDATAセクション内では,列<nt def='NT-CDEnd'>CDEnd</nt>だけを&markup;として認識するので,&left-angle-bracket;及びアンパサンドは,その&literal;形式で出現してよい。それらは,"<code>&amp;lt;</code>"及び"<code>&amp;amp;</code>"を使用して&escape;する必要はない。CDATAセクションは,入れ子にはできない。
</termdef>
</p>
<p>"<code>&lt;greeting></code>"及び"<code>&lt;/greeting></code>"を,<termref def='dt-markup'>&markup;</termref>ではなく,<termref def='dt-chardata'>文字データ</termref>として認識するCDATAセクションの例を,次に示す。
<eg>&lt;![CDATA[&lt;greeting>Hello, world!&lt;/greeting>]]&gt;</eg>
</p>
</div2>
<div2 id='sec-prolog-dtd'>
<head>&prolog;及び文書型宣言</head>
<p><termdef id='dt-xmldecl' term='XML Declaration'>XML文書は,使用するXMLの&version;を指定する<term>XML宣言</term>で始めてもよく,又そうするのが望ましい。
</termdef>
</p>
<p>この&TR-or-Rec;のこの&version;に適合することを示すためには,&version;番号 "<code>1.0</code>" を使用しなければならない。ある文書が,この&TR-or-Rec;のこの&version;に適合しないとき,値"<code>1.0</code>"を使用するのは,&error;とする。この&TR-or-Rec;の今後の&version;に"<code>1.0</code>"以外の値を付与することが,XML作業グループの意図だが,XMLの将来の&version;を作成することの確約を示すわけではなく,作成したとしても,番号付けについて,特定の方法を使用することの確約を示すわけでもない。将来の&version;の可能性を除外しないので,必要な場合,自動的な&version;の認識を可能とする手段として,この構成子を提供する。&processor;は,サポートしていない&version;でラベル付けした文書を受け取ったとき,&error;を通知してもよい。
</p>
<p>XML文書内の&markup;の機能は,記憶構造及び論理構造を記述すること,並びに属性及び属性値の対を論理構造に関連づけることにある。XMLは,論理構造についての制約条件を定義するため,及びあらかじめ定義された記憶単位を使用できるための機構として,<termref def="dt-doctype">文書型宣言</termref>を提供する。<!-- old
The function of the markup in an XML document is to describe its
storage and logical structures, and associate attribute-value pairs with the
logical structure.
XML provides a
mechanism, the <termref def="dt-doctype">document type declaration</termref>,
to
define constraints on that logical structure and to support the use of
predefined storage units. --><termdef id="dt-valid" term="Validity">XML文書が<term>&valid;</term>とは,文書型宣言をもち,その文書型宣言に示す制約条件を満たすこととする。
</termdef></p>
<p>文書型宣言は,文書の最初の<termref def="dt-element">要素</termref>の前に現れなければならない。
<scrap lang="ebnf" id='xmldoc'>
<head>&prolog;</head>
<prodgroup pcw2="6" pcw4="17.5" pcw5="9">
<prod id='NT-prolog'><lhs>prolog</lhs>
<rhs><nt def='NT-XMLDecl'>XMLDecl</nt>?
<nt def='NT-Misc'>Misc</nt>*
(<nt def='NT-doctypedecl'>doctypedecl</nt>
<nt def='NT-Misc'>Misc</nt>*)?</rhs></prod>
<prod id='NT-XMLDecl'><lhs>XMLDecl</lhs>
<rhs>&xmlpio;
<nt def='NT-VersionInfo'>VersionInfo</nt>
<nt def='NT-EncodingDecl'>EncodingDecl</nt>?
<nt def='NT-SDDecl'>SDDecl</nt>?
<nt def="NT-S">S</nt>?
&pic;</rhs>
</prod>
<prod id='NT-VersionInfo'><lhs>VersionInfo</lhs>
<rhs><nt def="NT-S">S</nt> 'version' <nt def='NT-Eq'>Eq</nt>
('"<nt def="NT-VersionNum">VersionNum</nt>"'
| "'<nt def="NT-VersionNum">VersionNum</nt>'")</rhs>
</prod>
<prod id='NT-Eq'><lhs>Eq</lhs>
<rhs><nt def='NT-S'>S</nt>? '=' <nt def='NT-S'>S</nt>?</rhs></prod>
<prod id="NT-VersionNum">
<lhs>VersionNum</lhs>
<rhs>([a-zA-Z0-9_.:] | '-')+</rhs>
</prod>
<prod id='NT-Misc'><lhs>Misc</lhs>
<rhs><nt def='NT-Comment'>Comment</nt> | <nt def='NT-PI'>PI</nt> |
<nt def='NT-S'>S</nt></rhs></prod>
</prodgroup>
</scrap></p>
<p>
例えば,次に示す完全なXML文書は,<termref def="dt-wellformed">&well-formed;</termref>であるが<termref def="dt-valid">&valid;</termref>ではない。
<eg><![CDATA[<?xml version="1.0"?>
<greeting>Hello, world!</greeting>
]]></eg>
次の文書も同様とする。
<eg><![CDATA[<greeting>Hello, world!</greeting>
]]></eg>
</p>
<p><termdef id="dt-doctype" term="Document Type Declaration">
XMLの<term>文書型宣言</term>は,ある文書クラスのための文法を提供する<termref def='dt-markupdecl'>&markup;宣言</termref>を含むか,又は参照する。この文法を,文書型定義又は<term>DTD</term>という。文書型宣言は,&markup;宣言を含んだ外部&subset;(特別な種類の<termref def='dt-extent'>外部実体</termref>)を参照でき,又は内部&subset;に直接&markup;宣言を含むこともできる。さらに,その両方も可能とする。ある文書のDTDは,両方の&subset;をまとめたものとして構成する。</termdef>
</p>
<p><termdef id="dt-markupdecl" term="markup declaration">
<term>&markup;宣言</term>は,<termref def="dt-eldecl">要素型宣言</termref><termref def="dt-attdecl">属性リスト宣言</termref><termref def="dt-entdecl">実体宣言</termref>又は<termref def="dt-notdecl">記法宣言</termref>とする。</termdef>次に示す&well-formed;制約及び&validity;制約に規定するが,これらの宣言は,<termref def='dt-PE'>&parameter;実体</termref>内に全体又は一部が含まれてもよい。詳しい規定は,<titleref href="sec-physical-struct">物理構造</titleref>に関する規定を参照のこと。</p>
<scrap lang="ebnf" id='dtd'>
<head>文書型定義</head>
<prodgroup pcw2="6" pcw4="17.5" pcw5="9">
<prod id='NT-doctypedecl'><lhs>doctypedecl</lhs>
<rhs>'&lt;!DOCTYPE' <nt def='NT-S'>S</nt>
<nt def='NT-Name'>Name</nt> (<nt def='NT-S'>S</nt>
<nt def='NT-ExternalID'>ExternalID</nt>)?
<nt def='NT-S'>S</nt>? ('['
(<nt def='NT-markupdecl'>markupdecl</nt>
| <nt def='NT-PEReference'>PEReference</nt>
| <nt def='NT-S'>S</nt>)*
']'
<nt def='NT-S'>S</nt>?)? '>'</rhs>
<vc def="vc-roottype"/>
<!--<vc def="vc-nonnullDTD"/>-->
</prod>
<!--
<prod id='NT-markupdecls'><lhs>markupdecls</lhs>
<rhs>
(<nt def='NT-S'>S</nt>?
<nt def='NT-markupdecl'>markupdecl</nt>
<nt def='NT-S'>S</nt>?)*
</rhs></prod>
-->
<prod id='NT-markupdecl'><lhs>markupdecl</lhs>
<rhs><nt def='NT-elementdecl'>elementdecl</nt>
| <nt def='NT-AttlistDecl'>AttlistDecl</nt>
| <nt def='NT-EntityDecl'>EntityDecl</nt>
| <nt def='NT-NotationDecl'>NotationDecl</nt>
| <nt def='NT-PI'>PI</nt>
| <nt def='NT-Comment'>Comment</nt>
<!--| <nt def='NT-InternalPERef'>InternalPERef</nt> --></rhs>
<vc def='vc-PEinMarkupDecl'/>
<wfc def="wfc-PEinInternalSubset"/>
</prod>
<!--
<prod id="NT-InternalPERef"><lhs>InternalPERef</lhs>
<rhs><nt def="NT-PEReference">PEReference</nt></rhs>
<wfc def="wfc-integraldec"/>
</prod>
-->
</prodgroup>
</scrap>
<vcnote id="vc-roottype">
<head>&root;要素型</head>
<p>
文書型宣言における<nt def='NT-Name'>Name</nt>は,&root;要素の型と&match;しなければならない。
</p>
</vcnote>
<!--
<vcnote id="vc-nonnullDTD">
<head>Non-null DTD</head>
<p>
The internal and external subsets of the DTD must not both
be empty.
</p>
</vcnote>
-->
<vcnote id='vc-PEinMarkupDecl'>
<head>宣言及び&parameter;実体が厳密に入れ子をなすこと</head>
<p>&parameter;実体<termref def='dt-repltext'>の&replacement-text;</termref>は,&markup;宣言内において,厳密に入れ子になっていなければならない。つまり,&markup;宣言(<nt def='NT-markupdecl'>markupdecl</nt>)の最初又は最後の文字が,<termref def='dt-PERef'>&parameter;実体参照</termref>の対象となる&replacement-text;に含まれれば,両方とも同じ&replacement-text;に含まれなければならない。</p>
</vcnote>
<wfcnote id="wfc-PEinInternalSubset">
<head>内部&subset;内の&parameter;実体</head>
<p>DTDの内部&subset;では,<termref def='dt-PERef'>&parameter;実体参照</termref>は,&markup;宣言が出現可能な場所だけに出現できる。&markup;宣言内には出現できない(この制約は,外部&parameter;実体又は外部&subset;での参照には適用しない。)。
</p>
</wfcnote>
<p>
内部&subset;のときと同様に,外部&subset;及びDTDにおいて参照する任意の外部&parameter;実体は,非終端記号<nt def="NT-markupdecl">markupdecl</nt>によって許される型の,一連の完全な&markup;宣言で構成されなければならない。&markup;宣言の間には,空白又は<termref def="dt-PERef">&parameter;実体参照</termref>を置いてもよい。しかし,外部&subset;又は外部&parameter;実体の内容の一部は,<termref def="dt-cond-section">条件付きセクション</termref>を使用して無視してもよい。内部サブセットでは,これは許されない。
<!--In the external subset, however, parameter-entity references can
be used to replace constructs prefixed by "<code>%</code>" in a production of
the grammar, and <termref def="dt-cond-section">conditional sections</termref>
may occur.
In the internal subset, by contrast, conditional sections may not
occur and the only parameter-entity references
allowed are those which match the non-terminal
<nt def="NT-InternalPERef">InternalPERef</nt>
within the rule for <nt def="NT-doctypedecl">markupdecl</nt>.
-->
<scrap id="ext-Subset">
<head>外部&subset;</head>
<prodgroup pcw2="6" pcw4="17.5" pcw5="9">
<prod id='NT-extSubset'><lhs>extSubset</lhs>
<rhs>(
<nt def='NT-markupdecl'>markupdecl</nt>
| <nt def='NT-conditionalSect'>conditionalSect</nt>
| <nt def='NT-PEReference'>PEReference</nt>
| <nt def='NT-S'>S</nt>
)*</rhs>
</prod>
</prodgroup>
</scrap></p>
<p>外部&subset;及び外部&parameter;実体は,その内では,&parameter;実体が&markup;宣言の<emph></emph>だけでなく,&markup;宣言の<emph></emph>でも認識される,という点でも内部&subset;とは異なる。
</p>
<p>文書型宣言付きのXML文書の例を,次に示す。
<eg><![CDATA[<?xml version="1.0"?>
<!DOCTYPE greeting SYSTEM "hello.dtd">
<greeting>Hello, world!</greeting>
]]></eg>
<termref def="dt-sysid">システム&identifier;</termref> "<code>hello.dtd</code>"が,文書のDTDのURIとなる。</p>
<p>次の例のとおり,宣言を局所的に与えることもできる。
<eg><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (#PCDATA)>
]>
<greeting>Hello, world!</greeting>
]]></eg>
外部&subset;及び内部&subset;の両方を使用するときは,内部&subset;が外部&subset;より先に出現したと見なす。<!--* 'is considered to'? boo. whazzat mean? -->これは,内部&subset;の実体及び属性リスト宣言が,外部&subset;の実体及び属性リスト宣言より優先するという効果をもたらす。
</p>
</div2>
<div2 id='sec-rmd'>
<head>&standalone;文書宣言</head>
<p><termref def="dt-xml-proc">XML&processor;</termref>は,&application;に文書の内容を渡すが,&markup;宣言は,この内容に影響を与えることがある。属性の&default-value;及び実体宣言をその例とする。XML宣言の一部分として出現できる&standalone;文書宣言は,文書が,その&markup;宣言の存在によって影響されないことを指し示す(普通,その&markup;宣言が存在しないために,これがいえる。)。
<scrap lang="ebnf" id='fulldtd'>
<head>&standalone;文書宣言</head>
<prodgroup pcw2="4" pcw4="19.5" pcw5="9">
<prod id='NT-SDDecl'><lhs>SDDecl</lhs>
<rhs>
<nt def="NT-S">S</nt>
'standalone' <nt def='NT-Eq'>Eq</nt> "'" ('yes' | 'no') "'"
</rhs>
<rhs>
| <nt def="NT-S">S</nt>
'standalone' <nt def='NT-Eq'>Eq</nt> '"' ('yes' | 'no') '"'
</rhs><vc def='vc-check-rmd'/></prod>
</prodgroup>
</scrap></p>
<p>&standalone;文書宣言においては, "<code>yes</code>"の値は,<termref def='dt-docent'>文書実体</termref>の外部に(DTDの外部&subset;内に,又は内部&subset;から参照される外部パラメタ実体内に),XML&processor;から&application;へと渡される情報に影響する&markup;宣言が存在しないことを意味する。"<code>no</code>"の値は,その外部&markup;宣言が存在するか,又は存在する可能性があることを意味する。&standalone;文書宣言は,その<emph>宣言</emph>が文書外部に存在するかどうかを示すだけに注意すること。外部実体への参照が文書内に存在していても,その実体が内部的に宣言されているときは,文書の&standalone;の状態には影響を与えない。</p>
<p>外部に&markup;宣言が存在しなければ,&standalone;文書宣言は意味をもたない。外部に&markup;宣言が存在し,&standalone;文書宣言が存在しない場合は,<code>"no"</code> の値の設定を仮定する。</p>
<p>XML文書で <code>standalone="no"</code> が設定されているものは,あるアルゴリズムで&standalone;文書に変換でき,この文書は,ネットワーク配信&application;にとって望ましいかもしれない。</p>
<vcnote id='vc-check-rmd'>
<head>&standalone;文書宣言</head>
<p>&standalone;文書宣言は,何らかの外部&markup;宣言が次のいずれかを宣言しているときは,値 "<code>no</code>" を取らなければならない。
<ulist>
<item><p>a) <termref def="dt-default">&default;</termref>値付きの属性であって,この属性が適用される要素が,属性値を指定せずに文書内に現れるもの。</p></item>
<item><p>b) &magicents;以外の実体であって,その実体に対する<termref def="dt-entref">参照</termref>が文書内に出現するもの。</p>
</item>
<item><p>c) 値が<titleref href='AVNormalize'>正規化</titleref>の対象となる属性であって,正規化の結果として変化する値が文書内で属性に指定されるもの。</p></item>
<item>
<p>d) <termref def="dt-elemcontent">要素内容</termref>をもつ要素型であって,空白がその要素型のいずれかのインスタンス内に直接現れるもの。
</p></item>
</ulist>
</p>
</vcnote>
<p>&standalone;文書宣言付きのXML宣言の例を,次に示す。
<eg>&lt;?xml version="&XML.version;" standalone='yes'?></eg></p>
</div2>
<div2 id='sec-white-space'>
<head>空白の取扱い</head>
<p>XML文書を編集するときは,&markup;を目立たせ読みやすくするために,“空白”(&space;,タブ及び空白行。この&TR-or-Rec;では,非終端記号の<nt def='NT-S'>S</nt>で表す)を使うと便利なことが多い。その空白は,配布する&version;の文書の一部として含めることを意図しないのを普通とする。しかし,“意味のある”空白であって,配布する&version;に残さなければならないものも多い。例えば,詩及びソースコードにおける空白がある。</p>
<p><termref def='dt-xml-proc'>XML&processor;</termref>は,文書内の&markup;以外のすべての文字を,そのまま変更せずに&application;に渡さなければならない。<termref def='dt-validating'>&validating;XML&processor;</termref>は,<termref def="dt-elemcontent">要素内容</termref>の中の空白を他の非&markup;文字から区別し,&application;側に要素内容の中の空白が重要でないということを伝えなければならない。</p>
<p>
"<code>xml:space</code>"という特別な<termref def='dt-attr'>属性</termref>を文書に挿入することによって,空白を重要とする意図を示してもよい。この属性を適用する要素に現れる空白を,アプリケーションが重要なものとして扱うことを要求する,という意図を示す。</p>
<p>&valid;な文書では,この属性を使用する場合は,他の属性と同じように<termref def="dt-attdecl">宣言</termref>しなければならない。宣言するときは,取り得る値を"<code>default</code>"及び "<code>preserve</code>"だけとする<termref def='dt-enumerated'>列挙型</termref>でなければならない。
</p>
<p>値"<code>default</code>"は,&application;の&default;の空白処理モードを,その要素に適用可能とすることを意味する。値"<code>preserve</code>"は,&application;がすべての空白を保存することを意味する。この宣言の意図は,"<code>xml:space</code>" 属性の別の指定で上書きしない限り,要素の内容に現れるすべての要素に適用すると解釈する。</p>
<p>文書の<termref def='dt-root'>&root;要素</termref>については,この属性の値を指定するか,又はこの属性の&default-value;がある場合を除いては,&application;による空白の取扱いについて,いかなる意図も示さないと解釈する。</p>
<p>例を次に示す。
<eg><![CDATA[ <!ATTLIST poem xml:space (default|preserve) 'preserve'>]]></eg>
</p>
</div2>
<div2 id='sec-line-ends'>
<head>行末の取扱い</head>
<p>XMLの<termref def='dt-parsedent'>構文&parsed-entity;</termref>は,通常コンピュータのファイル内に保存され,編集の便宜のために複数の行に分けることが多い。これらの行は,普通は,<code>CR</code> (#xD)コード及び <code>LF</code> (#xA)コードの何らかの組合せによって分けられる。</p>
<p><termref def='dt-app'>&application;</termref>の処理を簡単にするため,外部&parsed-entity;又は内部&parsed-entity;の&literal;実体値が,"<code>#xD#xA</code>" の2文字の連続とする&literal;又は<code>#xD</code>の単独の&literal;を含む場合に,<termref def='dt-xml-proc'>XML&processor;</termref>は,&application;に単一の文字<code>#xA</code>だけを渡さなければならない(この処理は,入力内に存在する改行コードを構文解析の前に正規化することによって,容易に実現できる。)。</p>
</div2>
<div2 id='sec-lang-tag'>
<head>&language-identification;</head>
<p>文書処理においては,その文書の中身がどんな自然言語又は形式言語で書かれているか明示することが,役に立つことが多い。<!--ここで使用する“言語”という言葉の意味は,"Espa&#x00F1;ol" 及び"EBNF"の双方で例示される意味とする。--><!-- x00F1: spanish's small ntilde--></p>
<!--; この情報は(例をあげれば)文書の文字の表示,並びに情報抽出のための語幹・形態素解析及びテキストブロックの整形に影響を及ぼす可能性がある。-->
<p>XML文書内の要素のもつ内容又は属性値において使用する<!--自然又は形式-->言語を指定するために,"<code>xml:lang</code>" という名前の特別な<termref def="dt-attr">属性</termref>を,文書内に挿入してもよい。
<!--; この属性はXML規定の一部として,複数のXML&application;の相互運用性を高めるために定義する。-->
属性の値は,<bibref ref="RFC1766"/>“RFC1766:&language-identification;のためのタグ”によって規定される&language-identification;コードに従う。
<scrap lang='ebnf'>
<head>&language-identification;</head>
<prod id='NT-LanguageID'><lhs>LanguageID</lhs>
<rhs><nt def='NT-Langcode'>Langcode</nt>
('-' <nt def='NT-Subcode'>Subcode</nt>)*</rhs></prod>
<prod id='NT-Langcode'><lhs>Langcode</lhs>
<rhs><nt def='NT-ISO639Code'>ISO639Code</nt> |
<nt def='NT-IanaCode'>IanaCode</nt> |
<nt def='NT-UserCode'>UserCode</nt></rhs>
</prod>
<prod id='NT-ISO639Code'><lhs>ISO639Code</lhs>
<rhs>([a-z] | [A-Z]) ([a-z] | [A-Z])</rhs></prod>
<prod id='NT-IanaCode'><lhs>IanaCode</lhs>
<rhs>('i' | 'I') '-' ([a-z] | [A-Z])+</rhs></prod>
<prod id='NT-UserCode'><lhs>UserCode</lhs>
<rhs>('x' | 'X') '-' ([a-z] | [A-Z])+</rhs></prod>
<prod id='NT-Subcode'><lhs>Subcode</lhs>
<rhs>([a-z] | [A-Z])+</rhs></prod>
</scrap>
<nt def='NT-Langcode'>Langcode</nt>は,次のどれでもよい。
<ulist>
<item><p>a) <bibref ref="ISO639"/>“言語の名前表現のためのコード”で規定される2文字の&language-code;</p></item>
<item><p>b) Internet Assigned Numbers Authority (IANA)で登録されている&language-code;。これは,先頭が "<code>i-</code>" (又は"<code>I-</code>")で始まる。</p></item>
<item><p>c) &user;によって定められた&language-code;,又は私的な使用のために複数の団体間が取り決めたコード。これらは,今後IANAにおいて標準化又は登録されるコードとの競合を避けるために,先頭を"<code>x-</code>" 又は "<code>X-</code>" で始める。</p></item>
</ulist></p>
<p><nt def='NT-Subcode'>Subcode</nt>は,複数回使ってもよい。最初のサブコードが存在し,その内容が二つの文字から成るときは,<bibref ref="ISO3166"/>ISO3166の“国名を表すコード(国コード)”でなければならない。最初のサブコードが3文字以上から成るときは,<nt def='NT-Langcode'>Langcode</nt>の先頭が,"<code>x-</code>" 又は "<code>X-</code>"で始まらない限り,指定した言語に対するサブコードとし,IANAに登録されたものでなければならない。</p>
<p>&language-code;は,小文字での表記を,&country-code;は,(存在するならば)大文字での表記を慣行とする。しかし,XML文書内における他の名前とは異なり,これらの値については,大文字及び小文字の区別をしないことに注意すること。</p>
<p>例を次に示す。
<eg><![CDATA[<p xml:lang="en">The quick brown fox jumps over the lazy dog.</p>
<p xml:lang="en-GB">What colour is it?</p>
<p xml:lang="en-US">What color is it?</p>
<sp who="Faust" desc='leise' xml:lang="de">
<l>Habe nun, ach! Philosophie,</l>
<l>Juristerei, und Medizin</l>
<l>und leider auch Theologie</l>
<l>]]><!-- x00DF german's es-zet; x00FC german's u-umlaut -->durchaus studiert mit hei&#223;em Bem&#252;h'n.<![CDATA[</l>
</sp>]]></eg></p>
<!--<p>xml:lang の値は,要素の内容及び(属性の&default-value;で定めない限り)フリーテキスト(CDATA)の値をもつその要素へのすべての属性の値について,その両方に適用する。-->
<p><code>xml:lang</code>で宣言する意図は,<code>xml:lang</code>の別の指定で上書しない限り,指定した要素の内容に含むすべての要素に適用する。</p>
<!--ある要素における xml:lang 属性の値が定められておらず,DTDにおいてその&default-value;が定められていない場合,その要素のxml:lang 属性の値は,親要素での値が存在する場合は,それを引き継ぐ。 次の例における二つの<term>という名前の専門用語を表す要素は,xml:langの値に関しては,実際上,同じ値をもつ。
<p xml:lang="en">Here the keywords are
<term xml:lang="en">shift</term> and
<term>reduce</term>. ...</p>
XML&processor;ではなく&application;が,この属性値の継承について責任をもつ。
-->
<p>
&valid;な文書においては,この&TR-or-Rec;の他の場所で規定するとおり,この属性を必ず宣言しなければならない。通常,宣言は,次の形とする。
<eg>xml:lang NMTOKEN #IMPLIED</eg>
必要ならば,特定の&default-value;を与えてもよい。英語を母語とする学生用のフランス語の詩集では,説明及び注を英語で記述すれば,xml:lang 属性を次のとおりに宣言することとなる。
<eg><![CDATA[ <!ATTLIST poem xml:lang NMTOKEN 'fr'>
<!ATTLIST gloss xml:lang NMTOKEN 'en'>
<!ATTLIST note xml:lang NMTOKEN 'en'>]]></eg>
</p>
<!--
DTDの設計者は,スクリプトを言語(及びその派生体)に包摂して扱うのではなく,スクリプト及び言語を同次元で扱うのが適当な場合,言語属性と同様にスクリプト属性が存在すれば有用だと思うかもしれない。リンク要素において,参照された又はリンクされたリソースにおける(主要な)言語(場合によっては複数)を表す要素を定義するのも望ましい。しかし,これらの&application;は,この&TR-or-Rec;が規定する範囲外とする。-->
</div2>
</div1>
<!-- &Elements; -->
<div1 id='sec-logical-struct'>
<head>論理構造</head>
<p><termdef id="dt-element" term="Element">いかなる<termref def="dt-xml-doc">XML文書</termref>も,一つ以上の<term>要素</term>を含む。要素の境界は, <termref def="dt-stag">開始タグ</termref>及び<termref def="dt-etag">終了タグ</termref>によって区切る。要素が<termref def="dt-empty"></termref>要素のときは,<termref def="dt-eetag">空要素タグ</termref>で示す。各々の要素は,型をもつ。要素型は名前(共通&identifier;(generic identifier)又はGIと呼ぶことがある。)によって&identified;。要素は,いくつかの属性をもつことができる。</termdef>属性は,<termref def="dt-attrname">名前</termref>及び<termref def="dt-attrval"></termref>をもつ。</p>
<scrap lang='ebnf'><head>要素</head>
<prod id='NT-element'><lhs>element</lhs>
<rhs><nt def='NT-EmptyElemTag'>EmptyElemTag</nt></rhs>
<rhs>| <nt def='NT-STag'>STag</nt> <nt def='NT-content'>content</nt>
<nt def='NT-ETag'>ETag</nt></rhs><wfc def='GIMatch'/></prod>
</scrap>
<p>この&TR-or-Rec;は,要素型及び属性の意味,使用方法,又は(構文に関することを除き)名前に制約を与えない。ただし,先頭が<code>(('X'|'x')('M'|'m')('L'|'l'))</code>に&match;する名前は,この版又は今後の版のこの&TR-or-Rec;での標準化のために予約する。</p>
<wfcnote id='GIMatch'><head>要素型の&match;</head>
<p>要素の終了タグの<nt def='NT-Name'>名前</nt>は,その要素の開始タグにおける型と&match;しなければならない。</p>
</wfcnote>
<div2 id='sec-starttags'>
<head>開始タグ,終了タグ及び空要素タグ</head>
<p><termdef id="dt-stag" term="Start-Tag">空でない任意のXML要素の始まりは,<term>開始タグ</term>によって&markup;する。
<scrap lang='ebnf'><head>開始タグ</head>
<prodgroup pcw2="6" pcw4="15" pcw5="11.5">
<prod id='NT-STag'><lhs>STag</lhs><rhs>'&lt;' <nt def='NT-Name'>Name</nt> (<nt def='NT-S'>S</nt> <nt def='NT-Attribute'>Attribute</nt>)* <nt def='NT-S'>S</nt>? '>'</rhs><wfc def="uniqattspec"/></prod>
<prod id='NT-Attribute'><lhs>Attribute</lhs><rhs><nt def='NT-Name'>Name</nt> <nt def='NT-Eq'>Eq</nt> <nt def='NT-AttValue'>AttValue</nt></rhs><vc def='ValueType'/><wfc def='NoExternalRefs'/><wfc def='CleanAttrVals'/></prod>
</prodgroup>
</scrap>
開始タグ及び終了タグ内の<nt def='NT-Name'>Name</nt>は,要素の<term></term>を表わす。</termdef><termdef id="dt-attr" term="Attribute"><nt def='NT-Name'>Name</nt>及び<nt def='NT-AttValue'>AttValue</nt>の対を要素の<term>属性指定</term>といい</termdef><termdef id="dt-attrname" term="Attribute Name">個々の対における<nt def='NT-Name'>Name</nt>は,<term>属性名</term></termdef>及び<termdef id="dt-attrval" term="Attribute Value"><nt def='NT-AttValue'>AttValue</nt>の内容(区切り子<code>'</code>又は<code>"</code>の間の&string;)を<term>属性値</term>という。</termdef></p>
<wfcnote id='uniqattspec'><head>属性指定の一意性</head>
<p>開始タグ又は空要素タグでは,同一の属性名が2度以上出現してはならない。</p></wfcnote>
<vcnote id='ValueType'><head>属性値の型</head>
<p>属性は宣言されていなければならない。属性値の型は,その属性に対して宣言した型でなければならない(属性の型については,<titleref href='AttDecls'>属性リスト宣言</titleref>についての規定を参照。)。</p></vcnote>
<wfcnote id='NoExternalRefs'><head>外部実体への参照がないこと</head>
<p>属性値には,外部実体への直接的又は間接的な参照を含むことはできない。</p></wfcnote>
<wfcnote id='CleanAttrVals'><head>属性値に<code>&lt;</code>を含まないこと</head>
<p>属性値内で直接的又は間接的に参照する実体(<code>&amp;lt;</code>を除く。)の<termref def='dt-repltext'>&replacement-text;</termref>には,<code>&lt;</code>を含んではならない。</p></wfcnote>
<p>開始タグの例を,次に示す。
<eg>&lt;termdef id="dt-dog" term="dog"></eg></p>
<p><termdef id="dt-etag" term="End Tag">開始タグで始まる要素の終わりは,<term>終了タグ</term>で&markup;しなければならない。この終了タグは,対応する開始タグの要素型と同じ名前をもつ。
<scrap lang='ebnf'><head>終了タグ</head><prodgroup pcw2="6" pcw4="15" pcw5="11.5"><prod id='NT-ETag'><lhs>ETag</lhs><rhs>'&lt;/' <nt def='NT-Name'>Name</nt> <nt def='NT-S'>S</nt>? '>'</rhs></prod></prodgroup></scrap></termdef></p>
<p>終了タグの例を,次に示す。
<eg>&lt;/termdef></eg></p>
<p><termdef id="dt-content" term="Content">要素の開始タグと終了タグとの間の<termref def='dt-text'>テキスト</termref>を,その要素の<term>内容</term>という。
<scrap lang='ebnf'><head>要素の内容</head>
<prodgroup pcw2="6" pcw4="15" pcw5="11.5"><prod id='NT-content'><lhs>content</lhs><rhs>(<nt def='NT-element'>element</nt> | <nt def='NT-CharData'>CharData</nt> | <nt def='NT-Reference'>Reference</nt> | <nt def='NT-CDSect'>CDSect</nt> | <nt def='NT-PI'>PI</nt> | <nt def='NT-Comment'>Comment</nt>)*</rhs></prod></prodgroup></scrap></termdef></p>
<p><termdef id="dt-empty" term="Empty">要素が<term></term>のとき,その要素は,直後に終了タグをもつ開始タグ又は空要素タグで表現しなければならない。</termdef><termdef id="dt-eetag" term="empty-element tag"><term>空要素タグ</term>は,次の特別な形式をとる。
<scrap lang='ebnf'><head>空要素のためのタグ</head><prodgroup pcw2="6" pcw4="15" pcw5="11.5"><prod id='NT-EmptyElemTag'><lhs>EmptyElemTag</lhs><rhs>'&lt;' <nt def='NT-Name'>Name</nt> (<nt def='NT-S'>S</nt> <nt def='NT-Attribute'>Attribute</nt>)* <nt def='NT-S'>S</nt>? '/&gt;'</rhs><wfc def="uniqattspec"/></prod></prodgroup></scrap></termdef></p>
<!-- 門馬:上の“空要素のためのタグ(tags for empty elements)”は“空要素タグ(empty-element tag)”とすべきだと思いますが,いかがでしょうか -->
<p>空要素タグは,内容をもたない任意の要素の表現に利用できる。空要素タグで表現する要素を,キーワード<kw>EMPTY</kw>を用いて宣言しなくともよい。</p>
<p>空要素の例を,次に示す。
<eg>&lt;IMG align="left" src="http://www.w3.org/Icons/WWW/w3c_home" />&lt;br>&lt;/br>&lt;br/></eg></p>
</div2>
<div2 id='elemdecls'><head>要素宣言</head>
<p><termref def="dt-valid">&validity;</termref>を保証するため,要素宣言及び属性リスト宣言を用いて<termref def="dt-xml-doc">XML文書</termref><termref def="dt-element">要素</termref>の構造に,制約を加えることができる。</p>
<p>要素宣言は,要素の<termref def="dt-content">内容</termref>についての制約とする。</p>
<p>要素宣言は,要素の<termref def="dt-parentchild"></termref>として出現可能な要素型について,制約を加えることが多い。&at-user-option;,要素宣言をもたない要素型が他の要素宣言によって参照されれば,XML&processor;は,警告を出してもよい。しかし,これは&error;とはしない。</p>
<p><termdef id="dt-eldecl" term="Element Type declaration"><term>要素型宣言</term>は,次の形式をとる。
<scrap lang='ebnf'><head>要素型宣言</head><prodgroup pcw2="5.5" pcw4="18" pcw5="9">
<prod id='NT-elementdecl'><lhs>elementdecl</lhs>
<rhs>'&lt;!ELEMENT' <nt def='NT-S'>S</nt>
<nt def='NT-Name'>Name</nt>
<nt def='NT-S'>S</nt>
<nt def='NT-contentspec'>contentspec</nt>
<nt def='NT-S'>S</nt>? '>'</rhs>
<vc def='EDUnique'/></prod>
<prod id='NT-contentspec'><lhs>contentspec</lhs>
<rhs>'EMPTY'
| 'ANY'
| <nt def='NT-Mixed'>Mixed</nt>
| <nt def='NT-children'>children</nt>
</rhs>
<vc def='elementvalid'/>
</prod>
</prodgroup>
</scrap>
ここで,<nt def='NT-Name'>Name</nt>は,宣言されている要素の型とする。</termdef></p>
<vcnote id='EDUnique'><head>要素宣言の一意性</head>
<p>要素型を2度以上宣言できない。</p></vcnote>
<vcnote id='elementvalid'><head>要素の&validity;</head>
<p>要素が<!-- said to be -->&valid;とは,<nt def='NT-elementdecl'>elementdecl</nt>に&match;する宣言であって,その<nt def='NT-Name'>Name</nt>がその要素型と&match;し,次のいずれかの条件を満たす場合とする。<ulist>
<item><p>a) 宣言が<kw>EMPTY</kw>に&match;し,要素が<termref def='dt-content'>内容</termref>をもたない。</p></item>
<item><p>b) 宣言が<nt def='NT-children'>children</nt>に&match;し,要素の<termref def="dt-parentchild">子要素</termref>の並びが,内容モデルの正規表現によって生成される言語に属する。</p></item>
<item><p>c) 宣言が<nt def='NT-Mixed'>mixed</nt>に&match;し,要素の内容が<termref def='dt-chardata'>文字データ</termref>及び<termref def='dt-parentchild'>子要素</termref>からなる。子要素の要素型は,要素の内容モデルに出現する名前に&match;する。</p></item>
<item><p>d) 宣言が<kw>ANY</kw>に&match;し,どの<termref def='dt-parentchild'>子要素</termref>の要素型も宣言されている。</p></item></ulist>
</p></vcnote>
<!-- with the new VC, I don't think the next few paras add anything -TWB
<p><termdef id="dt-model" term="content model">An element can declared using a <term>content model</term>, in which case its content can be categorized as <termref def="dt-elemcontent">element content</termref> or <termref def='dt-mixed'>mixed content</termref>, as explained below.</termdef></p>
<p>An element whose type declared using the keyword <kw>EMPTY</kw> must be <termref def="dt-empty">empty</termref> and may be tagged using an <termref def="dt-eetag">empty-element tag</termref> when it appears in the document.</p>
<p>If an element type is declared using the keyword <kw>ANY</kw>, then there are no validity constraints on its content: it may contain <termref def='dt-parentchild'>child elements</termref> of any type and number, interspersed with character data.</p> -->
<p>要素宣言の例を,次に示す。
<eg>
&lt;!ELEMENT br EMPTY>
&lt;!ELEMENT p (#PCDATA|emph)* >
&lt;!ELEMENT %name.para; %content.para; >
&lt;!ELEMENT container ANY>
</eg></p>
<div3 id='sec-element-content'><head>要素内容</head>
<p><termdef id='dt-elemcontent' term='Element content'>ある型の要素が<termref def='dt-parentchild'></termref>要素だけを含む(文字データを含まない。)とき,その要素<termref def="dt-stag"></termref>は,<term>要素内容</term>をもつ,という。</termdef>この場合,制約は,内容モデルを含む。内容モデルは,子要素の型及び子要素の出現順序を制御する簡単な文法とする。この文法は,&content-particle;(<nt def='NT-cp'>cp</nt>s)からなる。&content-particle;は,名前,&content-particle;の選択リスト又は&content-particle;の列リストから構成される。
<scrap lang='ebnf'><head>要素内容モデル</head><prodgroup pcw2="5.5" pcw4="16" pcw5="11">
<prod id='NT-children'><lhs>children</lhs><rhs>(<nt def='NT-choice'>choice</nt> | <nt def='NT-seq'>seq</nt>) ('?' | '*' | '+')?</rhs></prod><prod id='NT-cp'><lhs>cp</lhs><rhs>(<nt def='NT-Name'>Name</nt> | <nt def='NT-choice'>choice</nt> | <nt def='NT-seq'>seq</nt>) ('?' | '*' | '+')?</rhs></prod>
<prod id='NT-choice'><lhs>choice</lhs><rhs>'(' <nt def='NT-S'>S</nt>? cp ( <nt def='NT-S'>S</nt>? '|' <nt def='NT-S'>S</nt>? <nt def='NT-cp'>cp</nt> )*<nt def='NT-S'>S</nt>? ')'</rhs><vc def='vc-PEinGroup'/></prod>
<prod id='NT-seq'><lhs>seq</lhs><rhs>'(' <nt def='NT-S'>S</nt>? cp ( <nt def='NT-S'>S</nt>? ',' <nt def='NT-S'>S</nt>? <nt def='NT-cp'>cp</nt> )*<nt def='NT-S'>S</nt>? ')'</rhs><vc def='vc-PEinGroup'/></prod>
<!-- <prod id='NT-cps'><lhs>cps</lhs><rhs><nt def='NT-S'>S</nt>? <nt def='NT-cp'>cp</nt> <nt def='NT-S'>S</nt>?</rhs></prod>
<prod id='NT-choice'><lhs>choice</lhs><rhs>'(' <nt def='NT-S'>S</nt>? <nt def='NT-ctokplus'>ctokplus</nt> (<nt def='NT-S'>S</nt>? '|' <nt def='NT-S'>S</nt>? <nt def='NT-ctoks'>ctoks</nt>)* <nt def='NT-S'>S</nt>? ')'</rhs></prod>
<prod id="NT-ctokplus"><lhs>ctokplus</lhs><rhs><nt def="NT-cps">cps</nt>('|' <nt def="NT-cps">cps</nt>)+</rhs></prod>
<prod id="NT-ctoks"><lhs>ctoks</lhs><rhs><nt def="NT-cps">cps</nt>('|' <nt def="NT-cps">cps</nt>)*</rhs></prod>
<prod id='NT-seq'><lhs>seq</lhs><rhs>'(' <nt def='NT-S'>S</nt>?<nt def='NT-stoks'>stoks</nt> (<nt def='NT-S'>S</nt>? ',' <nt def='NT-S'>S</nt>? <nt def='NT-stoks'>stoks</nt>)*<nt def='NT-S'>S</nt>? ')'</rhs></prod>
<prod id="NT-stoks"><lhs>stoks</lhs><rhs><nt def="NT-cps">cps</nt>(',' <nt def="NT-cps">cps</nt>)*</rhs></prod>
-->
</prodgroup></scrap>
ここで,<nt def='NT-Name'>Name</nt>は,<termref def="dt-parentchild"></termref>として出現してよい要素の型を示す。この文法で選択リストが現れる位置では,選択リスト内のいずれの&content-particle;も<termref def="dt-elemcontent">要素内容</termref>の中に現れてよい。列リストに現れる&content-particle;は,リストで指定する順番のとおりに,<termref def="dt-elemcontent">要素内容</termref>に現れなければならない。名前又はリストの後に出現するオプションの文字<!-- 門馬:characterを文字と訳しました -->は,リスト内の要素又は&content-particle;が,1回以上任意の回数(<code>+</code>),0回以上任意の回数(<code>*</code>)又は0回若しくは1回(<code>?</code>)出現可能なことを規定する。ここで示す構文及び意味は,この&TR-or-Rec;における生成規則で用いるものと同一とする。</p>
<!-- 門馬:上の文では,“name又はlistの後に続く文字”が“listの出現を規定する”とあって,nameの出現を規定するとは書いてありません。修正が必要と考えます。 -->
<p>要素の内容が内容モデルに&match;するのは,列,選択及び繰返し演算子にしたがって,内容の中の要素と内容モデル内の要素型とを&match;させながら,内容モデル内の一つのパスをたどれるときに限る。<termref def='dt-compat'>互換性のため</termref>,文書内の要素が,内容モデルにおける要素型の複数の出現位置と&match;することは,&error;とする。詳細な規定については,附属書の<titleref href="determinism">決定的内容モデル</titleref>の項を参照。
<!-- appendix <specref ref="determinism"/>. -->
<!-- appendix on deterministic content models. -->
</p>
<vcnote id='vc-PEinGroup'>
<head>グループ及びパラメタ実体が厳密な入れ子をなしていること</head>
<p>パラメタ実体の<termref def='dt-repltext'>&replacement-text;</termref>は,&parenthesis;で囲まれたグループによって,厳密な入れ子を構成しなければならない。つまり,<nt def='NT-choice'>選択</nt><nt def='NT-seq'></nt>又は<nt def='NT-Mixed'>混在</nt>部品に,&left-parenthesis;又は&right-parenthesis;のいずれか一方が<termref def='dt-PERef'>パラメタ実体</termref>の&replacement-text;に含れれば,他方も同じ&replacement-text;に含まれなければならない。</p>
<p><termref def='dt-interop'>相互運用性のため</termref>,パラメタ実体参照が<nt def='NT-choice'>選択</nt><nt def='NT-seq'></nt>又は<nt def='NT-Mixed'>混在</nt>内容に含まれれば,その&replacement-text;は空でないことが望ましく,&replacement-text;の先頭及び末尾の空白でない文字は,コネクタ(<code>|</code>又は<code>,</code>)でない方がよい。
</p>
</vcnote>
<p>要素内容モデルのいくつかの例を,次に示す。
<eg>&lt;!ELEMENT spec (front, body, back?)>
&lt;!ELEMENT div1 (head, (p | list | note)*, div2*)>
&lt;!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*></eg></p>
</div3>
<div3 id='sec-mixed-content'>
<head>&mixed-content;</head>
<p><termdef id='dt-mixed' term='Mixed Content'>ある要素型の要素内に,<termref def="dt-parentchild"></termref>要素に混在して文字データが含まれる可能性があるとき,その要素<termref def='dt-stag'></termref>は,<term>&mixed-content;</term>をもつという。</termdef>この場合,子要素の型についての制約が存在してもよい<!-- 門馬:“may be constrained”を単に「制約される」と訳しました。 -->が,子要素の順序又は出現回数についての制約はないとする。
<scrap lang='ebnf'>
<head>&mixed-content;宣言</head>
<prodgroup pcw2="5.5" pcw4="16" pcw5="11">
<prod id='NT-Mixed'><lhs>Mixed</lhs>
<rhs>'(' <nt def='NT-S'>S</nt>?
'#PCDATA'
(<nt def='NT-S'>S</nt>?
'|'
<nt def='NT-S'>S</nt>?
<nt def='NT-Name'>Name</nt>)*
<nt def='NT-S'>S</nt>?
')*' </rhs>
<rhs>| '(' <nt def='NT-S'>S</nt>? '#PCDATA' <nt def='NT-S'>S</nt>? ')'
</rhs><vc def='vc-PEinGroup'/>
<vc def='vc-MixedChildrenUnique'/>
</prod>
<!--
<prod id="NT-Mtoks"><lhs>Mtoks</lhs>
<rhs><nt def="NT-Name">Name</nt>
(<nt def='NT-S'>S</nt>?
'|'
<nt def='NT-S'>S</nt>?
<nt def="NT-Name">Name</nt>)*
</rhs>
</prod>
-->
</prodgroup>
</scrap>
ここで,<nt def='NT-Name'>Name</nt>は,子として出現してもよい要素の型を示す。
</p>
<vcnote id='vc-MixedChildrenUnique'>
<head>要素型の重複の禁止</head>
<p>一つの&mixed-content;宣言内に,同じ名前が複数回出現してはならない。
</p></vcnote>
<p>&mixed-content;宣言の例を,次に示す。
<eg>&lt;!ELEMENT p (#PCDATA|a|ul|b|i|em)*>
&lt;!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* >
&lt;!ELEMENT b (#PCDATA)></eg></p>
</div3>
</div2>
<div2 id='attdecls'>
<head>属性リスト宣言</head>
<p>
<termref def="dt-attr">属性</termref>は,名前及び値の対を<termref def="dt-element">要素</termref>に関連付けるために用いる。属性指定は,<termref def="dt-stag">開始タグ</termref>又は<termref def="dt-eetag">空要素</termref>タグ内でだけ可能とする。したがって,属性を認識するための生成規則は,<titleref href='sec-starttags'>開始タグ</titleref>についての規定で示す。属性リスト宣言は,次の目的で用いる。
<ulist>
<item><p>a) ある要素型に適用する属性の集合を規定する。</p></item>
<item><p>b) 属性への型制約を設定する。</p></item>
<item><p>c) 属性の<termref def="dt-default">&default-value;</termref>を規定する。</p></item>
</ulist>
</p>
<p>
<termdef id="dt-attdecl" term="Attribute-List Declaration">
<term>属性リスト宣言</term>は,ある要素型と関連付けられた各属性に対し,名前,データ型及び(存在すれば)&default-value;を規定する。
<scrap lang='ebnf'>
<head>属性リスト宣言</head>
<prod id='NT-AttlistDecl'><lhs>AttlistDecl</lhs>
<rhs>'&lt;!ATTLIST' <nt def='NT-S'>S</nt>
<nt def='NT-Name'>Name</nt>
<nt def='NT-AttDef'>AttDef</nt>*
<nt def='NT-S'>S</nt>? '&gt;'</rhs>
</prod>
<prod id='NT-AttDef'><lhs>AttDef</lhs>
<rhs><nt def='NT-S'>S</nt> <nt def='NT-Name'>Name</nt>
<nt def='NT-S'>S</nt> <nt def='NT-AttType'>AttType</nt>
<nt def='NT-S'>S</nt> <nt def='NT-Default'>Default</nt></rhs>
</prod>
</scrap>
<nt def='NT-AttlistDecl'>AttlistDecl</nt>規則に存在する<nt def="NT-Name">Name</nt>は,要素型の名前とする。&at-user-option;,宣言していない要素型に対し属性を宣言したならば,XML&processor;は,警告を出してもよい。しかし,これは&error;とはしない。
<nt def='NT-AttDef'>AttDef</nt>規則における<nt def='NT-Name'>Name</nt>は,属性の名前とする。
</termdef>
</p>
<p>
ある要素に対して,複数の<nt def='NT-AttlistDecl'>AttlistDecl</nt>を与える場合,これらすべての内容はマージする。ある要素型の同じ属性に,複数の定義を与える場合には,最初の宣言を有効とし,他の宣言は無視する。<termref def='dt-interop'>相互運用性のために</termref>,DTDの作成者は,ある要素型には高々一つの属性リスト宣言しか与えない,ある属性名には高々一つの属性定義しか与えない,及びすべての属性リスト宣言には少なくとも一つの属性定義を与える,という選択をしてもよい。相互運用性のために,XML&processor;は,&at-user-option;,ある要素型に複数の属性リスト宣言を与えたり,ある属性に複数の属性定義を与えたりしたときに,警告を出してもよい。しかし,これは,&error;とはしない。
</p>
<div3 id='sec-attribute-types'>
<head>属性の型</head>
<p>
XMLの属性の型は,3種類とする。これらは,&string;型,&token;化型及び列挙型とする。&string;型は,値として任意の&string;をとる。&token;化型は,次に示す字句及び意味に関する様々な制約をもつ。
<scrap lang='ebnf'>
<head>Attribute Types</head>
<prodgroup pcw4="14" pcw5="11.5">
<prod id='NT-AttType'><lhs>AttType</lhs>
<rhs><nt def='NT-StringType'>StringType</nt>
| <nt def='NT-TokenizedType'>TokenizedType</nt>
| <nt def='NT-EnumeratedType'>EnumeratedType</nt>
</rhs>
</prod>
<prod id='NT-StringType'><lhs>StringType</lhs>
<rhs>'CDATA'</rhs>
</prod>
<prod id='NT-TokenizedType'><lhs>TokenizedType</lhs>
<rhs>'ID'</rhs>
<vc def='id'/>
<vc def='one-id-per-el'/>
<vc def='id-default'/>
<rhs>| 'IDREF'</rhs>
<vc def='idref'/>
<rhs>| 'IDREFS'</rhs>
<vc def='idref'/>
<rhs>| 'ENTITY'</rhs>
<vc def='entname'/>
<rhs>| 'ENTITIES'</rhs>
<vc def='entname'/>
<rhs>| 'NMTOKEN'</rhs>
<vc def='nmtok'/>
<rhs>| 'NMTOKENS'</rhs>
<vc def='nmtok'/></prod>
</prodgroup>
</scrap>
</p>
<vcnote id='id' >
<head>ID</head>
<p>
この型の値は,生成規則<code>Name</code>に&match;しなければならない。一つのXML文書内では,一つの名前が,この型の値として複数回現れてはならない。つまり,IDの値は,要素を一意に&identify;しなければならない。
</p>
</vcnote>
<vcnote id='one-id-per-el'>
<head>1要素ごとに1ID</head>
<p>
要素型は,複数のID属性値をもってはならない。
</p>
</vcnote>
<vcnote id='id-default'>
<head>ID属性の&default;</head>
<p>
ID属性は,&default;として,<code>#IMPLIED</code>又は<code>#REQUIRED</code>を宣言しなければならない。
</p>
</vcnote>
<vcnote id='idref'>
<head>IDREF</head>
<p>
<kw>IDREF</kw>型の値は,生成規則<nt def="NT-Name">Name</nt>に&match;しなければならない。<kw>IDREFS</kw>型の値は,生成規則<nt def="NT-Names">Names</nt>に&match;しなければならない。各々の<nt def='NT-Name'>Name</nt>は,XML文書内に存在する要素のID属性の値と&match;しなければならない。つまり,<kw>IDREF</kw>の値は,あるID属性の値と&match;しなければならない。
</p>
</vcnote>
<vcnote id='entname'>
<head>実体名</head>
<p>
<kw>ENTITY</kw>型の値は,生成規則<nt def="NT-Name">Name</nt>に&match;しなければならない。<kw>ENTITIES</kw>型の値は,生成規則<nt def="NT-Names">Names</nt>に&match;しなければならない。各々の<nt def="NT-Name">Name</nt>は,<termref def="dt-doctype">DTD</termref>で宣言する<termref def="dt-unparsed">&unparsed-entity;</termref>と&match;しなければならない。
</p>
</vcnote>
<vcnote id='nmtok'>
<head>名前&token;</head>
<p>
<kw>NMTOKEN</kw>型の値は,非終端記号<termref def="NT-Nmtoken">Nmtoken</termref>と&match;する&string;から構成されなければならない。<kw>NMTOKENS</kw>型の値は,非終端記号<termref def="NT-Nmtokens">Nmtokens</termref>と&match;する&string;から構成されなければならない。
</p>
</vcnote>
<p>
XML&processor;は,&application;に属性値を渡す前に,<titleref href="AVNormalize">属性値の正規化</titleref>で規定するとおりに,属性値を正規化しなければならない。
</p>
<p>
<termdef id='dt-enumerated' term='Enumerated Attribute Values'><term>列挙型の属性</term>は,宣言した値の一つを取ることができる。</termdef>列挙型には,2種類ある。
<scrap lang='ebnf'>
<head>列挙属性の型</head>
<prod id='NT-EnumeratedType'><lhs>EnumeratedType</lhs>
<rhs><nt def='NT-NotationType'>NotationType</nt>
| <nt def='NT-Enumeration'>Enumeration</nt>
</rhs></prod>
<prod id='NT-NotationType'><lhs>NotationType</lhs>
<rhs>'NOTATION'
<nt def='NT-S'>S</nt>
'('
<nt def='NT-S'>S</nt>?
<nt def='NT-Name'>Name</nt>
(<nt def='NT-S'>S</nt>? '|' <nt def='NT-Name'>Name</nt>)*
<nt def='NT-S'>S</nt>? ')'
</rhs>
<vc def='notatn' /></prod>
<prod id='NT-Enumeration'><lhs>Enumeration</lhs>
<rhs>'(' <nt def='NT-S'>S</nt>?
<nt def='NT-Nmtoken'>Nmtoken</nt>
(<nt def='NT-S'>S</nt>? '|'
<nt def='NT-S'>S</nt>?
<nt def='NT-Nmtoken'>Nmtoken</nt>)*
<nt def='NT-S'>S</nt>?
')'</rhs>
<vc def='enum'/></prod>
</scrap>
</p>
<vcnote id='notatn'>
<head>記法属性</head>
<p>この型の値は,宣言している<titleref href='Notations'>記法</titleref>の名前の一つと&match;しなければならない。つまり,宣言に存在する記法名は,すべて宣言されていなければならない。
</p>
</vcnote>
<vcnote id='enum'>
<head>列挙</head>
<p>
この型の値は,宣言に存在する<nt def='NT-Nmtoken'>Nmtoken</nt>&token;の一つと&match;しなければならない。
</p>
</vcnote>
<p>
<termref def='dt-interop'>相互運用性のため</termref>,同じ<nt def='NT-Nmtoken'>Nmtoken</nt>は,単一要素型の列挙型の属性として,複数回現れない方がよい。
</p>
</div3>
<div3 id='sec-attr-defaults'>
<head>属性の&default;</head>
<p>
<termref def="dt-attdecl">属性宣言</termref>は,属性の指定が必須かどうかについての情報を与える。必須でない場合には,文書内で属性を指定しないとき,XML&processor;の処理方法の情報も与える。
<scrap lang='ebnf'>
<head>属性の&default;</head>
<prodgroup pcw4="14" pcw5="11.5">
<prod id='NT-Default'><lhs>Default</lhs>
<rhs>'#REQUIRED'
|&nbsp;'#IMPLIED' </rhs>
<rhs>| (('#FIXED' S)? <nt def='NT-AttValue'>AttValue</nt>)</rhs>
<vc def='defattrvalid'/>
<wfc def="CleanAttrVals"/>
</prod>
</prodgroup>
</scrap>
<!-- improved by bosak
<scrap lang='ebnf'>
<head>Attribute Defaults</head>
<prod id='NT-Default'><lhs>Default</lhs>
<rhs>'#REQUIRED'
|&nbsp;'#IMPLIED' </rhs>
<vc def='defattrvalid'/>
<wfc def="CleanAttrVals"/>
<rhs>| (('#FIXED' S)? <nt def='NT-AttValue'>AttValue</nt>)</rhs>
</prod>
</scrap>-->
</p>
<vcnote id='defattrvalid'>
<head>属性&default;の正しさ</head>
<p>
宣言した&default-value;は,宣言した属性型の字句制約を満たさなければならない。
</p>
</vcnote>
<p>
<kw>#REQUIRED</kw>を指定したとき,この要素型の<termref def="dt-stag">開始タグ</termref>であって,この属性に値を与えないものをXML&processor;が見つけたならば,その文書は<termref def="dt-valid">&valid;</termref>とはしない。<kw>#IMPLIED</kw>を指定したとき,この属性を省略したら,XML&processor;は,属性値を指定しないことをアプリケーションに伝えなければならない。このとき,&application;の振舞いについての制約はない。
</p>
<p>
<termdef id="dt-default" term="Attribute Default">
属性が<kw>#REQUIRED</kw>でも<kw>#IMPLIED</kw>でもないときには,<nt def='NT-AttValue'>AttValue</nt>の値が,<term>&default-value;</term>となる。<kw>#FIXED</kw>の場合,&default-value;と異なる値が指定されれば,その文書は,<termref def="dt-valid">&valid;</termref>としない。&default-value;を宣言している場合,この属性の省略を見つけたら,宣言した&default-value;を属性値に指定しているとして,XML&processor;は振る舞うことが望ましい。
</termdef></p>
<p>属性リスト宣言の例を,次に示す。
<eg>&lt;!ATTLIST termdef
id ID #REQUIRED
name CDATA #IMPLIED>
&lt;!ATTLIST list
type (bullets|ordered|glossary) "ordered">
&lt;!ATTLIST form
method CDATA #FIXED "POST"></eg></p>
</div3>
<div3 id='AVNormalize'>
<head>属性値の正規化</head>
<p>
XML&processor;は,属性値を&application;に渡す前に,次のとおりに正規化しなければならない。
<ulist>
<item>
<p>a) まず,属性値及びその中の実体内で,行末又は行境界(又はシステムによってはレコード境界)として使われる&string;を,&space-character;(#x20)一つに置き換えなければならない(「<titleref href="sec-line-ends">行末の扱い</titleref>」も参照のこと。)。
</p></item>
<item>
<p>b) 次に,文字参照及び内部&parsed-entity;への参照は,展開しなければならない。外部実体への参照は,&error;とする。
</p></item>
<item>
<p>c) 最後に,属性の型が<kw>CDATA</kw>でなければ,空白&string;は,すべて&space-character;(#x20)一つに正規化し,残りの空白文字は,削除しなければならない。
</p></item>
</ulist>
&non-validating;&parser;は,宣言が見つからない属性は,すべて,<kw>CDATA</kw>を宣言しているとして扱うことが望ましい。</p>
</div3>
</div2>
<div2 id='sec-condition-sect'>
<head>条件付きセクション</head>
<p>
<termdef id='dt-cond-section' term='conditional section'>
<term>条件付きセクション</term>とは,<termref def='dt-doctype'>文書型宣言の外部&subset;</termref>の一部とし,制御キーワードの指定によって,DTDの論理構造に含めたり,除いたりする部分とする。
</termdef>
<scrap lang='ebnf'>
<head>条件付きセクション</head>
<prodgroup pcw2="9" pcw4="14.5">
<prod id='NT-conditionalSect'><lhs>conditionalSect</lhs>
<rhs><nt def='NT-includeSect'>includeSect</nt>
| <nt def='NT-ignoreSect'>ignoreSect</nt>
</rhs>
</prod>
<prod id='NT-includeSect'><lhs>includeSect</lhs>
<rhs>'&lt;![' S? 'INCLUDE' S? '['
<!-- (<nt def='NT-markupdecl'>markupdecl</nt>
| <nt def="NT-conditionalSect">conditionalSect</nt>
| <nt def="NT-S">S</nt>)*
-->
<nt def="NT-extSubset">extSubset</nt>
']]&gt;'
</rhs>
</prod>
<prod id='NT-ignoreSect'><lhs>ignoreSect</lhs>
<rhs>'&lt;![' S? 'IGNORE' S? '['
<nt def="NT-ignoreSectContents">ignoreSectContents</nt>*
']]&gt;'</rhs>
</prod>
<prod id='NT-ignoreSectContents'><lhs>ignoreSectContents</lhs>
<rhs><nt def='NT-Ignore'>Ignore</nt>
('&lt;![' <nt def='NT-ignoreSectContents'>ignoreSectContents</nt>
']]&gt;'
<nt def='NT-Ignore'>Ignore</nt>)*</rhs></prod>
<prod id='NT-Ignore'><lhs>Ignore</lhs>
<rhs><nt def='NT-Char'>Char</nt>* -
(<nt def='NT-Char'>Char</nt>* ('&lt;![' | ']]&gt;')
<nt def='NT-Char'>Char</nt>*)
</rhs></prod>
<!--<rhs>
((<nt def='NT-SkipLit'>SkipLit</nt>
| <nt def='NT-Comment'>Comment</nt>
| <nt def='NT-PI'>PI</nt>) -
(<nt def='NT-Char'>Char</nt>* ']]&gt;' <nt def='NT-Char'>Char</nt>*))
| ('&lt;![' <nt def='NT-ignoreSectContents'>ignoreSectContents</nt>*
']]&gt;')
</rhs>
<rhs>
| (<nt def='NT-Char'>Char</nt> - (']' | [&lt;'"]))
</rhs>
<rhs>
| ('&lt;!' (<nt def='NT-Char'>Char</nt> - ('-' | '[')))
</rhs>-->
</prodgroup>
</scrap>
</p>
<p>条件付きセクションは,DTDの内部&subset;及び外部&subset;と同様に,完全な宣言,コメント又は入れ子になった条件付きセクションを,いくつか含んでよい。これらの間に,空白が現れてもよい。
</p>
<p>
条件付きセクションのキーワードが<code>INCLUDE</code>ならば,XML&processor;は,この条件付きセクションの内容を,文書の一部として扱わなければならない。条件付きセクションのキーワードが<code>IGNORE</code>ならば,その条件付きセクションの内容は,文書の一部として扱わない。構文解析を正しく行うためには,無視する条件付きセクション(IGNORE)に関しても,内容を読まなければならないことに注意すること。これは,入れ子になった条件付きセクションを見つけ,(無視する)最も外側の条件付きセクションを正しく検出するためとする。キーワードを<code>INCLUDE</code>とする小さな条件付きセクションが,キーワードを<code>IGNORE</code>とするより大きな条件付きセクションに含まれるならば,外側及び内側の条件付きセクションの両方とも無視する。
</p>
<p>
条件付きセクションのキーワードがパラメタ実体参照ならば,XML&processor;は条件付きセクションの扱いを判断する前に,このパラメタ実体を展開しなければならない。
</p>
<p>例を次に示す。
<eg>&lt;!ENTITY % draft 'INCLUDE' >
&lt;!ENTITY % final 'IGNORE' >
&lt;![%draft;[
&lt;!ELEMENT book (comments*, title, body, supplements?)>
]]&gt;
&lt;![%final;[
&lt;!ELEMENT book (title, body, supplements?)>
]]&gt;
</eg>
</p>
</div2>
<!--
<div2 id='sec-pass-to-app'>
<head>XML Processor Treatment of Logical Structure</head>
<p>When an XML processor encounters a start-tag, it must make
at least the following information available to the application:
<ulist>
<item>
<p>the element type's generic identifier</p>
</item>
<item>
<p>the names of attributes known to apply to this element type
(validating processors must make available names of all attributes
declared for the element type; non-validating processors must
make available at least the names of the attributes for which
values are specified.
</p>
</item>
</ulist>
</p>
</div2>
-->
</div1>
<!-- &Entities; -->
<div1 id='sec-physical-struct'>
<head>物理構造</head>
<p>
<termdef id="dt-entity" term="Entity">
XML文書は,一つ以上の記憶単位から構成する。この記憶単位を,<term>実体</term>という。実体は,<term>内容</term>をもち,文書実体(以降参照)及び<termref def='dt-doctype'>外部DTD&subset;</termref>を除いて,<term>名前</term>で&identified;。
</termdef>
<!-- Added for CFG -->
<!-- obscurity amputated by TWB -->
<!-- entire sentence amputated by CMSMcQ: no one but NO ONE is
ready for entities declared as
<!ENTITY foo "http://www.foo.com/bar.xml#id">
and it's pointless to suggest that it's possible
under current circumstances. -->
<!-- An entity may be stored in, -->
<!--but need not be coterminous with, -->
<!-- but need not comprise the whole of, -->
<!-- a single physical storage object such as a file or -->
<!-- database field. -->
<!-- End sentence added for CFG -->各XML文書は,<termref def="dt-docent">文書実体</termref>と呼ぶ実体を一つもつ。<termref def="dt-xml-proc">XML&processor;</termref>は,この文書実体から処理を開始する。文書実体が,文書のすべてを含んでもよい。</p>
<p>実体は,&parsed-entity;又は&unparsed-entity;とする。<termdef id="dt-parsedent" term="Text Entity"><term>&parsed-entity;</term>の内容は,&parsed-entity;の<termref def='dt-repltext'>&replacement-text;</termref>と呼ぶ。この<termref def="dt-text">テキスト</termref>は,文書の本体の一部として解釈する。
</termdef>
</p>
<p>
<termdef id="dt-unparsed" term="Unparsed Entity">
<term>&unparsed-entity;</term>は,内容が<termref def='dt-text'>テキスト</termref>でもそうでなくともよいリソースとする。テキストの場合,XMLでなくともよい。各&unparsed-entity;には,<termref def="dt-notation">記法</termref>が関連付けられ,この記法は,名前で&identified;。記法の名前及び関連付けられた&identifier;を,XML&processor;が&application;に渡すという要件以外は,XMLは,&unparsed-entity;の内容を制限しない。
</termdef>
</p>
<p>&parsed-entity;は,実体参照によって名前で呼び出す。&unparsed-entity;は,<kw>ENTITY</kw>型又は<kw>ENTITIES</kw>型の属性の値として,名前で参照する。</p>
<p>
<termdef id='gen-entity' term='general entity'><term>一般実体</term>は,文書内容の中で使用する&parsed-entity;とする。あいまいにならない限り,この&TR-or-Rec;では,一般実体を単に<emph>実体</emph>と呼ぶ。</termdef><termdef id='dt-PE' term='Parameter entity'>パラメタ実体は,DTD内で使用する&parsed-entity;とする。</termdef>これらの2種類の実体は,異なる書式で参照し,異なる文脈で認識する。</p>
<!--
<div2 id='sec-synchro'>
<head>Logical and Physical Structures</head>
<p>The logical and physical structures (elements and entities)
in an XML document must
be properly nested.
<termref def='dt-stag'>Tags</termref> and <termref def='dt-element'>elements</termref> must
each begin and end in the same <termref def='dt-entity'>entity</termref>, but may
refer to other
entities internally; <termref def='dt-comment'>comments</termref>,
<termref def='dt-pi'>processing instructions</termref>,
<termref def='dt-charref'>character
references</termref>, and
<termref def='dt-entref'>entity references</termref> must each be contained entirely
within a single entity. Entities must each contain an integral number
of elements, comments, processing instructions, and references,
possibly together with character data not contained within any element
in the entity, or else they must contain non-textual data, which by
definition contains no elements.</p></div2>
-->
<div2 id='sec-references'>
<head>文字参照及び実体参照</head>
<p>
<termdef id="dt-charref" term="Character Reference">
<term>文字参照</term>は,ISO/IEC 10646文字集合の特定の文字,例えば,入力機器から直接入力不可能な文字を参照する。
<scrap lang='ebnf'>
<head>文字参照</head>
<prod id='NT-CharRef'><lhs>CharRef</lhs>
<rhs>'&amp;#' [0-9]+ ';' </rhs>
<rhs>| '&hcro;' [0-9a-fA-F]+ ';'</rhs>
<wfc def="wf-Legalchar"/>
</prod>
</scrap>
<wfcnote id="wf-Legalchar">
<head>正当な文字</head>
<p>文字参照で参照する文字は,非終端記号<termref def="NT-Char">Char</termref>に従わなければならない。</p>
</wfcnote>
文字が "<code>&amp;#x</code>" で始まれば,終端の "<code>;</code>" までの数字及びアルファベットは,ISO/IEC 10646 の文字コードの16進数表現とする。
<!--日本語訳について: letterはアルファベットと訳した。 三好 -->
文字が "<code>&amp;#</code>" で始まれば,終端の "<code>;</code>" までの数字は,文字コードの10進数表現とする。
</termdef>
</p>
<p>
<termdef id="dt-entref" term="Entity Reference">
<term>実体参照</term>は,名前の付いた実体の内容を参照する。</termdef><termdef id='dt-GERef' term='General Entity Reference'>一般実体への参照は,アンパサンド(<code>&amp;</code>)及びセミコロン(<code>;</code>)を区切り子として用いる。</termdef><termdef id='dt-PERef' term='Parameter-entity reference'><term>パラメタ実体</term>への参照は,パーセント記号(<code>%</code>)及びセミコロン(<code>;</code>)を区切り子として用いる。
</termdef>
</p>
<scrap lang="ebnf">
<head>実体参照</head>
<prod id='NT-Reference'><lhs>Reference</lhs>
<rhs><nt def='NT-EntityRef'>EntityRef</nt>
| <nt def='NT-CharRef'>CharRef</nt></rhs></prod>
<prod id='NT-EntityRef'><lhs>EntityRef</lhs>
<rhs>'&amp;' <nt def='NT-Name'>Name</nt> ';'</rhs>
<wfc def='wf-entdeclared'/>
<vc def='vc-entdeclared'/>
<wfc def='textent'/>
<wfc def='norecursion'/>
</prod>
<prod id='NT-PEReference'><lhs>PEReference</lhs>
<rhs>'%' <nt def='NT-Name'>Name</nt> ';'</rhs>
<wfc def='wf-entdeclared'/>
<vc def='vc-entdeclared'/>
<wfc def='textent'/>
<wfc def='norecursion'/>
<wfc def='indtd'/>
</prod>
</scrap>
<wfcnote id='wf-entdeclared'>
<head>実体が宣言されていること</head>
<p>DTDをもたない文書,パラメタ実体参照を含まない内部DTD&subset;だけをもつ文書,又は "<code>standalone='yes'</code>" をもつ文書において,実体参照で用いる <nt def='NT-Name'>Name</nt> は,その実体の宣言で与える名前と,<termref def="dt-match">&match;</termref>しなければならない。ただし,&well-formed;の文書は,実体&magicents; を宣言する必要はない。パラメタ実体の場合は,宣言は,参照に先行しなければならない。同様に,一般実体の場合は,属性リスト宣言の&default-value;内での参照より先に,宣言が現れなければならない。</p>
<p>外部&subset;又は外部パラメタ実体で実体を宣言するとき,&non-validating;&processor;が,宣言を読み,処理することを<titleref href='include-if-valid'>義務づけない</titleref>。それらの文書では,実体は宣言されなければならないという規則は,&well-formed;制約ではない。
</p>
</wfcnote>
<vcnote id="vc-entdeclared">
<head>実体が宣言されていること</head>
<p>
外部&subset;又は外部パラメタ実体をもっていて,"<code>standalone='no'</code>"をもつ文書において,実体参照で用いる <nt def='NT-Name'>Name</nt> は,その実体の宣言で与える名前と<termref def="dt-match">&match;</termref>しなければならない。相互運用性のため,&valid;な文書は<titleref href="sec-escapes">あらかじめ定義した実体の規定</titleref>で指定した書式によって,実体 &magicents;を宣言することが望ましい。パラメタ実体の場合は,宣言は,参照に先行しなければならない。同様に,一般実体の場合は,属性リスト宣言の&default-value;内での参照よりも先に,宣言が現れなければならない。
</p>
</vcnote>
<!-- FINAL EDIT: is this duplication too clumsy? -->
<wfcnote id='textent'>
<head>&parsed-entity;</head>
<p>
実体参照は,<termref def="dt-unparsed">&unparsed-entity;</termref>の名前を含んでいてはならない。&unparsed-entity;は,<kw>ENTITY</kw>型又は<kw>ENTITIES</kw> 型として宣言した<termref def="dt-attrval">属性値</termref>としてだけ参照できる。
</p>
</wfcnote>
<wfcnote id='norecursion'>
<head>再帰なし</head>
<p>&parsed-entity;は,それ自体への参照を,直接にも間接にも含んではならない。</p>
</wfcnote>
<wfcnote id='indtd'>
<head>DTDの中</head>
<p>
パラメタ実体参照は,<termref def='dt-doctype'>DTD</termref>内にだけ,出現してよい。
<!--
In the external DTD subset, a parameter-entity reference is
recognized only at the locations where
the nonterminal <nt def="NT-PEReference">PEReference</nt> or the
special operator <code>%</code> appears in a production of the
grammar. In the internal subset, parameter-entity references
are recognized only when they match
the <nt def="NT-InternalPERef">InternalPERef</nt> non-terminal
in the production for <nt def="NT-markupdecl">markupdecl</nt>.
-->
</p>
</wfcnote>
<p>
文字参照及び実体参照の例を,次に示す。
<eg>Type &lt;key>less-than&lt;/key> (&hcro;3C;) to save options.
This document was prepared on &amp;docdate; and
is classified &amp;security-level;.</eg>
</p>
<p>
パラメタ実体参照の例を,次に示す。
<eg>&lt;!ENTITY % ISOLat2
SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" >
%ISOLat2;
</eg>
</p>
</div2>
<div2 id='sec-entity-decl'>
<head>実体宣言</head>
<p>
<termdef id="dt-entdecl" term="entity declaration">
実体は,次のとおりに宣言する。
<scrap lang='ebnf'>
<head>実体宣言</head>
<prodgroup pcw2="5" pcw4="18.5">
<prod id='NT-EntityDecl'><lhs>EntityDecl</lhs>
<rhs><nt def="NT-GEDecl">GEDecl</nt></rhs><com>一般実体</com>
<rhs>| <nt def="NT-PEDecl">PEDecl</nt></rhs><com>パラメタ実体</com>
</prod>
<prod id='NT-GEDecl'><lhs>GEDecl</lhs>
<rhs>'&lt;!ENTITY' <nt def='NT-S'>S</nt> <nt def='NT-Name'>Name</nt>
<nt def='NT-S'>S</nt> <nt def='NT-EntityDef'>EntityDef</nt>
<nt def='NT-S'>S</nt>? '&gt;'</rhs>
</prod>
<prod id='NT-PEDecl'><lhs>PEDecl</lhs>
<rhs>| '&lt;!ENTITY' <nt def='NT-S'>S</nt> '%' <nt def='NT-S'>S</nt>
<nt def='NT-Name'>Name</nt> <nt def='NT-S'>S</nt>
<nt def='NT-PEDef'>PEDef</nt> <nt def='NT-S'>S</nt>? '&gt;'</rhs>
<com>パラメタ実体</com>
</prod>
<prod id='NT-EntityDef'><lhs>EntityDef</lhs>
<rhs><nt def='NT-EntityValue'>EntityValue</nt>
</rhs>
<!--<wfc def="WF-EntityValue"/>-->
<rhs>| <nt def='NT-ExternalDef'>ExternalDef</nt></rhs>
<!--<wfc def="WF-External"/>-->
</prod>
<!-- FINAL EDIT: what happened to WFs here? -->
<prod id='NT-PEDef'><lhs>PEDef</lhs>
<rhs><nt def='NT-EntityValue'>EntityValue</nt>
| <nt def='NT-ExternalID'>ExternalID</nt></rhs></prod>
</prodgroup>
</scrap>
<nt def='NT-Name'>Name</nt> は,<termref def="dt-entref">実体参照</termref>において実体を&identify;。&unparsed-entity;ならば,<kw>ENTITY</kw> 型又は<kw>ENTITIES</kw>型の属性値内で,実体を&identify;。同一の実体が一回以上宣言されれば,最初の宣言を用いる。&at-user-option;,複数回宣言される実体に関し,XML&processor;は,警告を出してもよい。
</termdef>
</p>
<!--
<wfcnote id="WF-Entityvalue">
<head>Well-Formed Internal Entity</head>
<p>General entities defined by an <nt
def="NT-EntityValue">EntityValue</nt> must be well-formed, as defined
in section <specref ref="wf-entities"/>.
</p>
</wfcnote>
<wfcnote id="WF-External">
<head>Well-Formed External Entity</head>
<p>General text entities defined by an <nt
def="NT-ExternalDef">ExternalDef</nt>, must be well-formed, as defined
in the section on <titleref
href="wf-entities">well-formed entities.</titleref>.</p>
</wfcnote>
-->
<div3 id='sec-internal-ent'>
<head>内部実体</head>
<p>
<termdef id='dt-internent' term="Internal Entity Replacement Text">
実体の定義が <nt def='NT-EntityValue'>EntityValue</nt>のとき,これを<term>内部実体</term>という。これは,別個の物理的記憶単位をもたず,実体の内容は,宣言内で与える。</termdef>正しく<termref def='dt-repltext'>&replacement-text;</termref>を生成するには,<termref def='dt-litentval'>&literal;実体値</termref>内での実体参照及び文字参照の処理が,必要となるかもしれないことに注意する。詳細は,<titleref href='intern-replacement'>内部実体の&replacement-text;の構築</titleref>を参照。
<!-- redundant -TWB
Within the <nt def="NT-EntityValue">EntityValue</nt>,
parameter-entity references and character references are recognized
and expanded immediately.
General-entity references within the
replacement text are not recognized
at the time the entity declaration is parsed, though they may be
recognized when the entity itself is referred to.
-->
</p>
<p>
内部実体は,<termref def="dt-parsedent">&parsed-entity;</termref>とする。
</p>
<p>内部実体宣言の例を,次に示す。
<eg>&lt;!ENTITY Pub-Status "This is a pre-release of the specification."></eg></p>
</div3>
<div3 id='sec-external-ent'>
<head>外部実体</head>
<p>
<termdef id="dt-extent" term="External Entity">
実体が内部実体でなければ,<term>外部実体</term>とし,次のとおりに宣言する。
<scrap lang='ebnf'>
<head>外部実体宣言</head>
<prod id='NT-ExternalDef'><lhs>ExternalDef</lhs>
<rhs><nt def='NT-ExternalID'>ExternalID</nt>
<nt def='NT-NDataDecl'>NDataDecl</nt>?</rhs></prod>
<prod id='NT-ExternalID'><lhs>ExternalID</lhs>
<rhs>'SYSTEM' <nt def='NT-S'>S</nt>
<nt def='NT-SystemLiteral'>SystemLiteral</nt></rhs>
<rhs>| 'PUBLIC' <nt def='NT-S'>S</nt>
<nt def='NT-PubidLiteral'>PubidLiteral</nt>
<nt def='NT-S'>S</nt>
<nt def='NT-SystemLiteral'>SystemLiteral</nt>
</rhs>
</prod>
<prod id='NT-NDataDecl'><lhs>NDataDecl</lhs>
<rhs><nt def='NT-S'>S</nt> 'NDATA' <nt def='NT-S'>S</nt>
<nt def='NT-Name'>Name</nt></rhs>
<vc def='not-declared'/></prod>
</scrap>
<nt def='NT-NDataDecl'>NDataDecl</nt> が存在すれば,この実体は,<termref def="dt-unparsed">&unparsed-entity;</termref>とし,そうでなければ,&parsed-entity;とする。</termdef>
</p>
<vcnote id='not-declared'>
<head>記法が宣言されていること</head>
<p>
<nt def='NT-Name'>Name</nt> は,宣言した<termref def="dt-notation">記法</termref>の名前と&match;しなければならない。
</p>
</vcnote>
<p>
<termdef id="dt-sysid" term="System Identifier">
キーワード <kw>SYSTEM</kw> の後の <nt def='NT-SystemLiteral'>SystemLiteral</nt> を,実体の<term>システム&identifier;</term>と呼ぶ。これはURIとし,その実体の内容を取り出すのに用いてもよい。</termdef>URIと共に使うことの多いハッシュ("<code>#</code>")及びフラグメント&identifier;は,正式には,URI自体の一部とはしない。フラグメント&identifier;が,システム&identifier;の部分として与えられている場合,XML&processor;は,&error;を出してもよい。この&TR-or-Rec;の範囲外の情報(例えば,ある特定のDTDの特別なXML要素又は特定の&application;の仕様によって定義された処理命令)によって上書きされない限り,相対的なURIは,その実体の位置,すなわち,その実体の宣言があるファイルに相対的とする。したがって,DTDの内部&subset;にある実体宣言での相対的なURIは,文書の位置について相対的とする。外部&subset;にある実体宣言での相対的なURIは,その外部&subset;を含むファイルの位置に相対的とする。
</p>
<p>
<termdef id="dt-pubid" term="Public identifier">
システム&identifier;以外に,外部実体は,<term>公開&identifier;</term>を含んでもよい。
</termdef>
実体の内容を取り出すXML&processor;は,この公開&identifier;を用いて,代わりのURIの生成を試みてもよい。XML&processor;がこれに失敗した場合は,システム&literal;として指定したURIを用いなければならない。&match;する前に,公開&identifier;内にある空白文字からなる&string;は,すべて単一の&space-character;(#x20)に正規化しなければならず,前後の空白文字は削除しなければならない。
</p>
<p>外部実体宣言の例を,次に示す。
<eg>&lt;!ENTITY open-hatch
SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
&lt;!ENTITY open-hatch
PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
"http://www.textuality.com/boilerplate/OpenHatch.xml">
&lt;!ENTITY hatch-pic
SYSTEM "../grafix/OpenHatch.gif"
NDATA gif ></eg></p>
</div3>
</div2>
<div2 id='TextEntities'>
<head>&parsed-entity;</head>
<div3 id='sec-TextDecl'>
<head>テキスト宣言</head>
<p>外部&parsed-entity;は,<term>テキスト宣言</term>で始まってもよい。
<scrap lang='ebnf'>
<head>テキスト宣言</head>
<prodgroup pcw4="12.5" pcw5="13">
<prod id='NT-TextDecl'><lhs>TextDecl</lhs>
<rhs>&xmlpio;
<nt def='NT-VersionInfo'>VersionInfo</nt>?
<nt def='NT-EncodingDecl'>EncodingDecl</nt>
<nt def='NT-S'>S</nt>? &pic;</rhs>
<!-- <wfc def='wfc-xmldecliteral'/> -->
<!-- <wfc def='wfc-no-nonleading-encdec'/> -->
</prod>
</prodgroup>
</scrap>
</p>
<p>テキスト宣言は,そのままの形で現れなければならず,&parsed-entity;への参照を経由してはならないことに注意する。</p>
<p>外部&parsed-entity;において,テキスト宣言は,先頭以外のいかなる位置にも出現しない。</p>
</div3>
<div3 id='wf-entities'>
<head>&well-formed;の&parsed-entity;</head>
<p>ラベル<nt def='NT-document'>document</nt>をもつ生成規則に&match;すれば,文書実体は,&well-formed;とする。ラベル<nt def='NT-ExtParsedEnt'>ExtParsedEnt</nt>をもつ生成規則に&match;すれば,外部の一般&parsed-entity;は,&well-formed;とする。ラベル<nt def='NT-ExtPE'>ExtPE</nt>をもつ生成規則に&match;すれば,外部パラメタ実体は,&well-formed;とする。
<scrap lang='ebnf'>
<head>&well-formed;の&parsed-entity;</head>
<prod id='NT-ExtParsedEnt'><lhs>ExtParsedEnt</lhs>
<rhs><nt def='NT-TextDecl'>TextDecl</nt>?
<nt def='NT-content'>content</nt></rhs>
</prod>
<prod id='NT-ExtPE'><lhs>ExtPE</lhs>
<rhs><nt def='NT-TextDecl'>TextDecl</nt>?
<nt def='NT-extSubset'>extSubset</nt></rhs>
</prod>
</scrap>
&replacement-text;が,ラベル<nt def='NT-content'>content</nt>をもつ生成規則に&match;すれば,内部の一般&parsed-entity;は,&well-formed;とする。DTDを最後まで読み込まないと,確実にこれを判定できないことに注意。すべての内部のパラメタ実体は,定義によって&well-formed;とする。
</p>
<p>実体が&well-formed;な結果として,XML文書の論理的及び物理的構造は,正しく入れ子となる。<termref def='dt-stag'>開始タグ</termref><termref def='dt-etag'>終了タグ</termref><termref def="dt-empty">空要素タグ</termref><termref def='dt-element'>要素</termref><termref def='dt-comment'>コメント</termref><termref def='dt-pi'>処理命令</termref><termref def='dt-charref'>文字参照</termref>及び<termref def='dt-entref'>実体参照</termref>が,一つの実体で開始し,別の実体で終了することはない。</p>
</div3>
<div3 id='charencoding'>
<head>実体における文字符号化</head>
<p>XML文書内の外部&parsed-entity;は,各々,別の文字符号化方式を用いてもよい。すべてのXML&processor;は,UTF-8で符号化した実体,UTF-16で符号化した実体を処理できなければならない。
<!--
It is recognized that for some purposes, the use of additional
ISO/IEC 10646 planes other than the Basic Multilingual Plane
may be required.
A facility for handling characters in these planes is therefore a
desirable characteristic in XML processors and applications.
-->
</p>
<p>UTF-16で符号化した実体は,ISO/IEC 10646の付録E及びUnicodeの付録Bで規定する&byte-order-mark;(ZERO WIDTH NO-BREAK SPACE文字,#xFEFF)で始まらなければならない。これは,符号化の標識であって,XML文書の&markup;の一部でも,文字データの一部でもない。XML&processor;は,UTF-8で符号化した文書とUTF-16で符号化した文書との区別を行うために,この文字を使用可能でなければならない。</p>
<p>XML&processor;は,UTF-8及びUTF-16で符号化した実体だけを読むことを必須とするが,他の符号化を世界では用いており,それらの符号化を用いる実体をXML&processor;が処理できることが望ましい。UTF-8又はUTF-16以外の符号化方式を用いて格納する&parsed-entity;は,符号化宣言を含む<titleref href='TextDecl'>テキスト宣言</titleref>で始めなければならない。
<scrap lang='ebnf'>
<head>符号化宣言</head>
<prod id='NT-EncodingDecl'><lhs>EncodingDecl</lhs>
<rhs><nt def="NT-S">S</nt>
'encoding' <nt def='NT-Eq'>Eq</nt>
'"' <nt def='NT-EncName'>EncName</nt> '"' | "'"
<nt def='NT-EncName'>EncName</nt> "'"
</rhs>
</prod>
<prod id='NT-EncName'><lhs>EncName</lhs>
<rhs>[A-Za-z] ([A-Za-z0-9._] | '-')*</rhs>
<com>ラテン文字だけを含む符号化名</com>
</prod>
</scrap>
<termref def='dt-docent'>文書実体</termref>では,符号化宣言は,<termref def="dt-xmldecl">XML宣言</termref>の一部とする。<nt def="NT-EncName">EncName</nt>は,使用する符号化方式の名前とする。
</p>
<!-- FINAL EDIT: check name of IANA and charset names -->
<p>符号化宣言では,値<code>UTF-8</code><code>UTF-16</code><code>ISO-10646-UCS-2</code>及び<code>ISO-10646-UCS-4</code>は,Unicode及びISO/IEC 10646の各種符号化のために用いる。値<code>ISO-8859-1</code>から<code>ISO-8859-9</code>までは,ISO 8859の対応するパートのために用いる。値<code>ISO-2022-JP</code><code>Shift_JIS</code>及び<code>EUC-JP</code>は,JIS X-0208-1997の各種符号化のために用いる。XML&processor;は,それ以外の符号化方式を認識してもよい。Internet Assigned Numbers Authority (IANA)に,(<emph>charset</emph>sとして)登録された文字符号化方式については,これら以外についても,登録された名前で参照することが望ましい。これらの登録された名前は,大文字・小文字の区別をせずに定義されているので,これらに対する比較を試みる&processor;は,大文字・小文字の区別をしない方法をとるのが望ましいことに注意する。</p>
<p>XML処理系に渡された実体が,符号化宣言を含むにもかかわらず,宣言で示したもの以外の方式で符号化されていたり,符号化宣言が,外部実体の最初以外の位置に出現すれば,<termref def="dt-error">&error;</termref>とする。
</p>
<p>&byte-order-mark;でも符号化宣言でも始まらない実体は,UTF-8符号化でなければならない。</p>
<p><!-- XML processors should make an effort to use all available
information, internal and external, to aid in detecting an entity's correct
encoding. Such information may include, but is not limited to:
<ulist><item><p>An HTTP header</p></item>
<item><p>A MIME header obtained other than through HTTP</p></item>
<item><p>Metadata provided by the native OS file system or by document
management software</p></item>
<item><p>The bit patterns at the front of an entity, which may
be analyzed to determine if
the application of any known encoding yields a valid encoding
declaration. See <titleref href='sec-guessing'>the appendix on
autodetection of character sets</titleref>
for a fuller description.</p></item></ulist> -->
処理できない符号化をもった実体をXML&processor;が発見したときは,&application;にその事実を通知し,<termref def='dt-fatal'>&fatal-error;</termref>として,処理を終了しなければならない。
<!--
inform the application of this fact and
may
allow the application to
request either that the entity should be treated as an <termref
def="dt-unparsed">unparsed entity</termref>, or that processing should
cease.-->
</p>
<p>符号化宣言の例を,次に示す。
<eg>&lt;?xml encoding='UTF-8'?>
&lt;?xml encoding='EUC-JP'?></eg></p>
</div3>
</div2>
<div2 id='entproc'>
<head>XML&processor;による実体及び参照の扱い</head>
<p>次の表は,文字参照,実体参照及び&unparsed-entity;の呼出しが現れる文脈及び各々の場合における<termref def='dt-xml-proc'>XML&processor;</termref>に要求する振舞いを要約する。一番左の列のラベルは,認識の文脈を示す。
<glist>
<gitem><label>内容における参照</label>
<def><p>要素の<termref def='dt-stag'>開始タグ</termref>及び<termref def='dt-etag'>終了タグ</termref>の間の任意の場所での参照。非終端記号<nt def='NT-content'>content</nt>に対応する。</p></def>
</gitem>
<gitem>
<label>属性値における参照</label>
<def><p><termref def='dt-stag'>開始タグ</termref>の属性の値,又は<termref def='dt-attdecl'>属性宣言</termref>における&default-value;のいずれかでの参照。非終端記号<nt def='NT-AttValue'>AttValue</nt>に対応する。</p></def></gitem>
<gitem>
<label>属性値として出現</label>
<def><p>参照ではなく,<nt def='NT-Name'>Name</nt>として出現。<code>ENTITY</code>型として宣言した属性の値,又は<code>ENTITIES</code>型として宣言した属性の値における&space;で区切る&token;の一つとして出現する。</p>
</def></gitem>
<gitem><label>実体値における参照</label>
<def><p>実体の宣言における,パラメタ又は内部実体の<termref def='dt-litentval'>&literal;実体値</termref>内の参照。非終端記号<nt def='NT-EntityValue'>EntityValue</nt>に対応する。</p></def></gitem>
<gitem><label>DTDにおける参照</label>
<def><p><termref def='dt-doctype'>DTD</termref>の内部&subset;又は外部&subset;での参照。ただし,<nt def='NT-EntityValue'>EntityValue</nt>又は<nt def="NT-AttValue">AttValue</nt>の外側とする。</p></def>
</gitem>
</glist></p>
<!-- border value changed by bosak -->
<htable border='1' cellpadding='7' align='center'>
<!-- tbody wrapper added by bosak -->
<htbody>
<tr><td bgcolor='&cellback;' rowspan='2' colspan='1'></td>
<td bgcolor='&cellback;' align='center' valign='bottom' colspan='4'>実体の型</td>
<td bgcolor='&cellback;' rowspan='2' align='center'>文字</td>
</tr>
<tr align='center' valign='bottom'>
<td bgcolor='&cellback;'>パラメタ</td>
<td bgcolor='&cellback;'>内部&newline;一般</td>
<td bgcolor='&cellback;'>外部&newline;&parsed-entity;&newline;一般</td>
<td bgcolor='&cellback;'>&unparsed-entity;</td>
</tr>
<tr align='center' valign='middle'>
<!--<td bgcolor='&cellback;' rowspan='4'>Recognition
Context</td>-->
<td bgcolor='&cellback;' align='right'>内容での&newline;参照</td>
<td bgcolor='&cellback;'><titleref href='not-recognized'>認識&newline;しない</titleref></td>
<td bgcolor='&cellback;'><titleref href='included'>取込み</titleref></td>
<td bgcolor='&cellback;'><titleref href='include-if-valid'>検証のために取込み</titleref></td>
<td bgcolor='&cellback;'><titleref href='forbidden'>禁止</titleref></td>
<td bgcolor='&cellback;'><titleref href='included'>取込み</titleref></td>
</tr>
<tr align='center' valign='middle'>
<td bgcolor='&cellback;' align='right'>属性値での&newline;参照</td>
<td bgcolor='&cellback;'><titleref href='not-recognized'>認識&newline;しない</titleref></td>
<td bgcolor='&cellback;'><titleref href='included'>取込み</titleref></td>
<td bgcolor='&cellback;'><titleref href='forbidden'>禁止</titleref></td>
<td bgcolor='&cellback;'><titleref href='forbidden'>禁止</titleref></td>
<td bgcolor='&cellback;'><titleref href='included'>取込み</titleref></td>
</tr>
<tr align='center' valign='middle'>
<td bgcolor='&cellback;' align='right'>属性値として&newline;出現</td>
<td bgcolor='&cellback;'><titleref href='not-recognized'>認識&newline;しない</titleref></td>
<td bgcolor='&cellback;'><titleref href='not-recognized'>禁止</titleref></td>
<td bgcolor='&cellback;'><titleref href='not-recognized'>禁止</titleref></td>
<td bgcolor='&cellback;'><titleref href='notify'>通知</titleref></td>
<td bgcolor='&cellback;'><titleref href='not recognized'>認識&newline;しない</titleref></td>
</tr>
<tr align='center' valign='middle'>
<td bgcolor='&cellback;' align='right'>実体値での&newline;参照</td>
<td bgcolor='&cellback;'><titleref href='included'>取込み</titleref></td>
<td bgcolor='&cellback;'><titleref href='bypass'>&bypass;</titleref></td>
<td bgcolor='&cellback;'><titleref href='bypass'>&bypass;</titleref></td>
<td bgcolor='&cellback;'><titleref href='forbidden'>禁止</titleref></td>
<td bgcolor='&cellback;'><titleref href='included'>取込み</titleref></td>
</tr>
<tr align='center' valign='middle'>
<td bgcolor='&cellback;' align='right'>DTDでの&newline;参照</td>
<td bgcolor='&cellback;'><titleref href='as-PE'>PEとして&newline;取込み</titleref></td>
<td bgcolor='&cellback;'><titleref href='forbidden'>禁止</titleref></td>
<td bgcolor='&cellback;'><titleref href='forbidden'>禁止</titleref></td>
<td bgcolor='&cellback;'><titleref href='forbidden'>禁止</titleref></td>
<td bgcolor='&cellback;'><titleref href='forbidden'>禁止</titleref></td>
</tr>
</htbody>
</htable>
<div3 id='not-recognized'>
<head>“認識しない”</head>
<p>DTDの外では,<code>%</code>文字は,いかなる特定の意味も,もたない。したがって,DTDではパラメタ実体参照として認識するものであっても,<nt def='NT-content'>content</nt>内では&markup;としては認識しない。同様に,適切に宣言した属性の値の中に現れる場合を除き,&unparsed-entity;の名前は,認識しない。
</p>
</div3>
<div3 id='included'>
<head>“取込み”</head>
<p><termdef id="dt-include" term="Include">実体は,その<termref def='dt-repltext'>&replacement-text;</termref>を取り出し,処理すると,参照自体の代わりに,参照があった位置で,文書の一部として含まれるかのように<term>取り込まれる</term>。&replacement-text;は,<termref def='dt-chardata'>文字データ</termref>及び(パラメタ実体を除く。)<termref def="dt-markup">&markup;</termref>のいずれを含んでもよく,これらは,通常の方法で認識されなければならない。ただし,&markup;の区切り子を&escape;するために用いる実体(&magicents;)の&replacement-text;は,常にデータとして扱う(&string;"<code>AT&amp;amp;T;</code>"は,"<code>AT&amp;T;</code>"に展開され,残されたアンパサンドは,実体参照の区切り子としては認識しない。)。文字参照は,示した文字を参照自体の代わりに処理するとき,<term>取り込まれる</term>
</termdef></p>
</div3>
<div3 id='include-if-valid'>
<head>“検証のために取込み”</head>
<p>文書の&validity;を<termref def="dt-valid">検証</termref>するには,XML&processor;が&parsed-entity;への参照を認識したとき,その&replacement-text;を<termref def="dt-include">取り込ま</termref>なければならない。実体が外部実体であって,XML文書の&validity;を検証しなければ,実体の&replacement-text;を取り込んでも<termref def="dt-may">よい</termref>が,そうしなくともよい。</p>
<p>この取決めは,SGML及びXMLの実体の機構が提供する自動取込み機能が,文書作成時のモジュール化を主な目的として設計されており,その他の&application;(特に,文書のブラウズ)には,必ずしも適切ではない,という認識による。例えば,ブラウザは外部&parsed-entity;への参照を見つけると,その実体が存在するという表示だけを行い,表示を要求されたときにだけ,内容を取り出すかもしれない。
</p>
</div3>
<div3 id='forbidden'>
<head>“禁止”</head>
<p>次は禁止されており,<termref def='dt-fatal'>&fatal-error;</termref>とする。
<ulist>
<item><p>a) <termref def='dt-unparsed'>&unparsed-entity;</termref>への参照の出現。
</p></item>
<item><p>b) DTDの<nt def='NT-EntityValue'>EntityValue</nt>又は<nt def="NT-AttValue">AttValue</nt>以外の部分における,文字参照又は一般実体への参照の出現。</p></item>
<item><p>c) 属性値内の外部実体への参照。</p>
</item>
</ulist>
</p>
</div3>
<div3 id='notify'>
<head>“通知”</head>
<p><termref def='dt-unparsed'>&unparsed-entity;</termref>の名前が,<kw>ENTITY</kw>又は<kw>ENTITIES</kw>の属性の値において&token;として現れたとき,&processor;は,&application;に対して,関連付けられた<termref def="dt-notation">記法</termref>名,記法に対する<termref def='dt-sysid'>システム</termref>&identifier;及び(存在すれば)<termref def='dt-pubid'>公開</termref>&identifier;を通知しなければならない。</p>
</div3>
<div3 id='bypass'>
<head>“&bypass;”</head>
<p>一般実体参照が,実体宣言における<nt def='NT-EntityValue'>EntityValue</nt>内に現れるとき,それは無視され,そのまま残る。</p>
</div3>
<div3 id='as-PE'>
<head>“PEとして取込み”</head>
<p>外部&parsed-entity;の場合と同様に,パラメタ実体は,&validity;を<titleref href='include-if-valid'>検証するときだけ取り込まれる</titleref>必要がある。パラメタ実体参照をDTD内に認識して取り込むとき,その<termref def='dt-repltext'>&replacement-text;</termref>は,その前後に一つの&space-character;(#x20)の付加によって引き伸ばされる。この意図は,パラメタ実体の&replacement-text;が,DTD内のいくつかの文法的&token;を完全に含むと,制約することにある。
</p>
</div3>
<!--
<div3 id='gen-char-entproc'>
<head>General and Character Entity Processing</head>
<p>General-entity and character references are recognized in three
contexts: wherever the nonterminal <nt def='NT-content'>content</nt> may
appear, at any point within the nonterminal
<nt def='NT-AttValue'>AttValue</nt>,
and within the
<termref def='dt-litentval'>literal entity value</termref>
(<nt def='NT-EntityValue'>EntityValue</nt>)
of an internal entity declaration.
This section discusses the first two cases; the third
is discussed <titleref href='intern-replacement'>below</titleref>.
When an <termref def="dt-xml-proc">XML processor</termref> encounters
such a reference, or the name of an unparsed entity as the value
of an <kw>ENTITY</kw> or <kw>ENTITIES</kw> attribute, then:
<olist>
<item><p>In all cases, the XML processor may
inform the application of the reference's occurrence and its identifier
(for an entity reference, the name; for a character
reference,
the character number in decimal, hexadecimal, or binary form).</p></item>
<item><p>For both character and entity references, the processor must
remove the reference itself from the <termref def="dt-text">text</termref> data
before passing the data to the application.
</p></item>
<item><p>For character references, the processor must
pass the character indicated
to the application in
place of the reference.
</p></item>
<item><p>For an external entity, the processor must inform the
application of the entity's <termref def="dt-sysid">system
identifier</termref>, and <termref def="dt-pubid">public identifier</termref>
if any.
All strings
of white space in the public identifier must be normalized to single space characters (#x20),
and leading and trailing white space must be removed.</p></item>
<item><p>If the external entity is binary, the processor must inform the
application of the associated <termref def="dt-notation">notation</termref>
name, and the notation's associated <termref def='dt-sysid'>system</termref>
and <termref def='dt-pubid'>public</termref> (if any)
identifiers.</p></item>
<item><p><termdef id="dt-include" term="Include">For an internal
(parsed) entity, the processor must <term>include</term> the
entity; that is, retrieve its replacement text
and process it as a part of the document
(i.e. as <nt def="NT-content">content</nt> or <nt
def="NT-AttValue">AttValue</nt>, whichever was being processed when
the reference was recognized), passing the result to the application
in place of the reference. The replacement text may contain both
<termref def='dt-chardata'>character data</termref>
and <termref def="dt-markup">markup</termref>, which must be recognized in
the usual way, except that the replacement text of entities used to escape
markup delimiters (the entities &magicents;) is always treated as
data. (The string "<code>AT&amp;amp;T;</code>" expands to
"<code>AT&amp;T;</code>" since the ampersand replacing "<code>&amp;amp;</code>"
is not recognized
as an entity-reference delimiter.) </termdef></p>
<p>Since the entity may contain other entity references,
an XML processor may have to repeat the inclusion process recursively.</p>
</item>
<item><p>If the entity is an external parsed entity, then in order to
<termref def="dt-valid">validate</termref> the XML document, the processor must
<termref def="dt-include">include</termref> the content of the
entity.</p></item>
<item><p>If the entity is an external parsed entity, and the processor is not
attempting to <termref def="dt-valid">validate</termref> the XML document, the
processor <termref def="dt-may">may</termref>, but need not, <termref
def="dt-include">include</termref> the entity's content.</p>
<p>This rule is based on the recognition that the automatic inclusion
provided by the SGML and XML entity mechanism, primarily designed
to support modularity in authoring, is not necessarily
appropriate for other applications, in particular document browsing.
Browsers, for example, when encountering an external parsed entity reference,
might choose to provide a visual indication of the entity's
presence and retrieve it for display only on demand.
</p></item>
</olist>
</p>
<p><termdef id="dt-escape" term="escape">Entity and character
references can both be used to <term>escape</term> the left angle bracket,
ampersand, and other delimiters. A set of general entities
(&magicents;) is specified for this purpose.
Numeric character references may also be used; they are
expanded immediately when recognized, and must be treated as
character data, so the numeric character references
"<code>&amp;#60;</code>" and "<code>&amp;#38;</code>" may be used to
escape <code>&lt;</code> and <code>&amp;</code> when they occur
in character data.</termdef></p>
</div3>
<div3 id='PE-proc'>
<head>Parameter Entity Processing</head>
<p>Parameter-entity references are only recognized in the
<termref def='dt-doctype'>DTD</termref>.
Their processing, when they appear
within the
<termref def='dt-litentval'>literal entity value</termref>
(<nt def='NT-EntityValue'>EntityValue</nt>)
of an internal entity declaration,
is discussed <titleref href='intern-replacement'>below</titleref>.
They have these intended uses:
<olist>
<item><p>as a replacement for one or more complete markup declarations</p></item>
<item><p>as a replacement for one or more complete "groups" in
element declarations</p></item>
<item><p>as a replacement for one or more complete "tokens" in
markup declarations</p></item>
</olist>
</p>
<p>The constraints requiring that PE replacement texts be properly nested
with <titleref href='vc-PEinMarkupDecl'>markup declarations</titleref>
and <titleref href='vc-PEinGroup'>content groups</titleref>
govern the first two usages.</p>
<p>To support the third intended usage,
when an XML processor encounters a parameter-entity reference
(outside of the
<termref def='dt-litentval'>literal entity value</termref> in an entity
declaration),
it must <termref def="dt-include">include</termref>
the named entity, but first expand its
<termref def='dt-repltext'>replacement text</termref> by attaching
space (#x20) characters to its beginning and the end, before
processing it.</p>
<p>The DTD text must match the relevant
rules of this specification's grammar after all parameter-entity
references have been expanded.
<!-In addition, parameter entities referred to in specific
contexts are required to satisfy certain constraints in their
replacement text; for example, a parameter entity referred to within
the internal DTD subset must match the rule for <nt
def="NT-markupdecl">markupdecl</nt>. ->
</p>
</div3>
-->
</div2>
<div2 id='intern-replacement'>
<head>内部実体&replacement-text;の構築</head>
<p>内部実体の取扱いの規定で,実体値を二つの形式に区別することは役に立つ。<termdef id="dt-litentval" term='Literal Entity Value'><term>&literal;実体値</term>は,実体宣言内に実際に存在する,引用符で囲む&string;とする。これは,非終端記号<nt def='NT-EntityValue'>EntityValue</nt>に&match;する。</termdef><termdef id='dt-repltext' term='Replacement Text'><term>&replacement-text;</term>は,文字参照及び&parameter;実体参照の置換え後における,実体の内容とする。</termdef></p>
<p>内部実体宣言内で与える&literal;実体値<!-- replacement text -->(<nt def='NT-EntityValue'>EntityValue</nt>)は,文字参照,&parameter;実体参照及び一般実体参照を含んでよい。これらの参照は,<!-- replacement text. -->&literal;実体値内に完全に含まれていなければならない。<termref def='dt-include'>展開する</termref>実際の&replacement-text;(先に示したもの)は,参照する&parameter;実体の<emph>&replacement-text;</emph>を含まなければならず,&literal;実体値内での文字参照の代わりに参照した文字を含まなければならない。しかし,一般実体参照は,そのまま残し, 展開してはならない。
<!-- in the replacement text that is to be included. -->
例えば,次の宣言を与えたとする。
<eg><![CDATA[<!ENTITY % pub "&#xc9;ditions Gallimard" >
<!ENTITY rights "All rights reserved" >
<!ENTITY book "La Peste: Albert Camus,
&#xA9; 1947 %pub;. &rights;" >]]></eg>
実体の&replacement-text;"<code>book</code>"は,次のとおりとなる。
<eg>La Peste: Albert Camus,
&#169; 1947 &#201;ditions Gallimard. &amp;rights;</eg>
参照"<code>&amp;book;</code>"が,文書の内容又は属性値内に出現していれば,一般実体参照"<code>&amp;rights;</code>"は,展開されている。</p>
<p>これらの単純な規則は,複合相互作用をもつ。
<!-- 日本語訳について: interaction = 相互作用(金本)-->
難しい例についての詳細は,<titleref href='sec-entexpand'>実体参照の展開の付録</titleref>を参照のこと。
</p>
<!-- Replaced by the above -TB
<p>Implementors of XML processors need to know the rules for
expansion of references in more detail. These rules only come into
play when the replacement text for an internal entity itself contains
other references.
<olist>
<item><p>In the replacement text of an internal entity, parameter-entity
references and character references in the replacement text
are recognized and resolved
when the entity declaration is parsed,
before the replacement text is stored in
the processor's symbol table.
General-entity references in the replacement text are not
resolved when the entity declaration is parsed.</p></item>
<item><p>In the document, when a general-entity reference is
resolved, its replacement text is parsed. Character references
encountered in the replacement text are
resolved immediately; general-entity references encountered in the
replacement text may be resolved or left unresolved, as described
<titleref href="entproc">above</titleref>.
Character and general-entity references must be
contained entirely within the entity's replacement text.
</p></item>
</olist>
</p>
<p>Simple character references do not suffice to escape delimiters
within the replacement text of an internal entity: they will be
expanded when the entity declaration is parsed, before the replacement
text is stored in the symbol table. When the entity itself is
referred to, the replacement text will be parsed again, and the
delimiters (no longer character references)
will be recognized as delimiters. To escape the
characters &magicents; in an entity replacement text, use
a general-entity reference or a doubly-escaped character reference.
See <titleref href='sec-entexpand'>the appendix on expansion
of entity references</titleref>
for detailed examples.</p>
-->
</div2>
<div2 id='sec-predefined-ent'>
<head>定義済み実体</head>
<p><termdef id="dt-escape" term="escape">
実体参照及び文字参照のいずれも,&left-angle-bracket;,アンバサンド及び他の区切り子を<term>&escape;</term>するために使用できる。いくつかの一般実体(&magicents;)を,この目的のために指定する。数値による文字参照も,同様の目的のために使用できる。文字参照は,認識されると直ちに展開され,文字データとして扱われるので,数値による文字参照"<code>&amp;#60;</code>"及び"<code>&amp;#38;</code>"は,文字データ内に出現する<code>&lt;</code>及び<code>&amp;</code>を&escape;するために使用できる。</termdef></p>
<p>すべてのXML&processor;は,宣言されているかどうかに関係なく,これらの実体を認識しなくてはならない。<termref def='dt-interop'>相互運用性のため</termref>,&valid;なXML文書は,これらの実体を使用する前に,他の実体と同様に,宣言することが望ましい。実体を宣言する場合は,&replacement-text;を&escape;する一文字とする内部実体として,次のとおりに宣言しなければならない。
<eg><![CDATA[<!ENTITY lt "&#38;#60;">
<!ENTITY gt "&#62;">
<!ENTITY amp "&#38;#38;">
<!ENTITY apos "&#39;">
<!ENTITY quot "&#34;">
]]></eg>
"<code>lt</code>"及び"<code>amp</code>"宣言内の"<code>&lt;</code>"及び"<code>&amp;</code>"文字は,実体の置換テキストが,&well-formed;となるように二重に&escape;されることに注意。
</p>
</div2>
<div2 id='Notations'>
<head>記法宣言</head>
<p>
<termdef id="dt-notation" term="Notation">
<term>記法</term>は,<termref def="dt-extent">&unparsed-entity;</termref>の形式を&identify;名前か,又は<termref def="dt-pi">処理命令</termref>の対象とする&application;を&identify;名前とする。</termdef></p>
<p><termdef id="dt-notdecl" term="Notation Declaration">
<term>記法宣言</term>は,記法の名前及び外部&identifier;を提供する。この名前は,実体及び属性リスト宣言並びに属性指定に用いる。外部&identifier;は,与えられた記法のデータを処理できるヘルパ&application;を,XML&processor;又はクライアントアプリケーションが探すために,利用できる。
<scrap lang='ebnf'>
<head>記法宣言</head>
<prod id='NT-NotationDecl'><lhs>NotationDecl</lhs>
<rhs>'&lt;!NOTATION' <nt def='NT-S'>S</nt> <nt def='NT-Name'>Name</nt>
<nt def='NT-S'>S</nt>
(<nt def='NT-ExternalID'>ExternalID</nt> |
<nt def='NT-PublicID'>PublicID</nt>)
<nt def='NT-S'>S</nt>? '>'</rhs></prod>
<prod id='NT-PublicID'><lhs>PublicID</lhs>
<rhs>'PUBLIC' <nt def='NT-S'>S</nt>
<nt def='NT-PubidLiteral'>PubidLiteral</nt>
</rhs></prod>
</scrap>
</termdef></p>
<p>宣言し,属性値,属性定義又は実体宣言で参照するすべての記法について,XML&processor;は,記法の名前及び外部&identifier;を&application;に提供しなければならない。さらに,外部&identifier;を,<termref def="dt-sysid">システム&identifier;</termref>,ファイル名又はその他の情報に展開してもよく,これらを用いて,&application;は,その記法のデータを処理する&processor;を起動する。(しかし,XML&processor;又は&application;が動作するシステムでは利用できない記法を,XML文書が宣言し参照しても,これは,&error;とはしない。)</p>
</div2>
<div2 id='sec-doc-entity'>
<head>文書実体</head>
<p><termdef id="dt-docent" term="Document Entity"><term>文書実体</term>は,実体の形成する木構造の&root;であって,<termref def="dt-xml-proc">XML&processor;</termref>が,処理を開始する地点とする。</termdef>この&TR-or-Rec;は,XML&processor;が,文書実体の存在する場所をどのように見つけるかは,規定しない。他の実体と異なり,文書実体は名前をもたず,いかなる識別もなしに&processor;への入力&stream;に出現してもよい。</p>
</div2>
</div1>
<!-- &Conformance; -->
<div1 id='sec-conformance'>
<head>適合性</head>
<p>適合する<termref def="dt-xml-proc">XML&processor;</termref>は,&validating;もの及び&non-validating;ものの,二つに分類される。</p>
<p>&validating;システム及び&non-validating;システムは,この&TR-or-Rec;が規定する&well-formed;制約への違反を報告しなければならない。</p>
<p><termdef id="dt-validating" term="Validating Processor"><term>&validating;&processor;</term>は,<termref def="dt-doctype">DTD</termref>内の宣言によって示された,制約への違反を報告しなければならない。さらに,この&TR-or-Rec;が規定する&validity;制約への違反を,すべて報告しなければならない。
</termdef>
</p>
</div1>
<div1 id='sec-notation'>
<head>記法</head>
<p>XMLの形式的な文法は,簡単な拡張Backus-Naur Form(EBNF)記法によって与える。文法の各規則は,次の形式で,記号を一つ定義する。
<eg>symbol ::= expression</eg></p>
<p>記号は,正規表現で定義するときは大文字で始め,そうでなければ,小文字で始める。&string;&literal;は,引用符で囲む。
<!--* The distinction between symbols which can and cannot be
recognized using simple regular expressions may be used to set the
boundary between an implementation's lexical scanner and its parser,
but this specification neither constrains the placement of that
boundary nor presupposes that all implementations will have one. *-->
</p>
<p>規則の右側の式内では,一つ又は複数の文字からなる&string;と&match;するために,次の式を使用する。
<glist>
<gitem>
<label><code>#xN</code></label>
<def><p>ここで,<code>N</code>は16進の整数とする。ISO/IEC 10646の文字であって,正規形(UCS-4)の&code-value;を符号なし2進数として解釈したとき,指定した値と等しいものと&match;する。<code>#xN</code>形式の先頭にゼロがいくつか現れるかは,意味をもたない。&code-value;<!-- bit string -->における先頭のゼロの数は,文字の符号化によって決定されるので,XMLにとっては意味がない。
</p></def>
</gitem>
<gitem>
<label><code>[a-zA-Z]</code>, <code>[#xN-#xN]</code></label>
<def><p>指定した範囲の値(両端の値を含む。)をもつ任意の<termref def='dt-character'>文字</termref>と&match;する。</p></def>
</gitem>
<gitem>
<label><code>[^a-z]</code>, <code>[^#xN-#xN]</code></label>
<def><p>指定した範囲<emph></emph>の値をもつ任意の<termref def='dt-character'>文字</termref>と&match;する。</p></def>
</gitem>
<gitem>
<label><code>[^abc]</code>, <code>[^#xN#xN#xN]</code></label>
<def><p>指定した文字以外の値をもつ任意の<termref def='dt-character'>文字</termref>と&match;する。</p></def>
</gitem>
<gitem>
<label><code>"string"</code></label>
<def><p>&double-quote;で囲む&string;&literal;と<termref def="dt-match">&match;している</termref>&string;&literal;と&match;する。</p></def>
</gitem>
<gitem>
<label><code>'string'</code></label>
<def><p>&single-quote;で囲む&string;&literal;と<termref def="dt-match">&match;している</termref>&string;&literal;と&match;する。</p></def>
</gitem>
</glist>
これらの記号は,次の形式の組合せで使用する。ここで,<code>A</code>及び<code>B</code>は,単純な式とする。
<glist>
<gitem>
<label>(<code>expression</code>)</label>
<def><p><code>expression</code>は,一つのまとまりとして扱い,ここに示す組合せで使ってもよい。</p></def>
</gitem>
<gitem>
<label><code>A?</code></label>
<def><p><code>A</code>又は何もなしと&match;する(オプションの<code>A</code>)。</p></def>
</gitem>
<gitem>
<label><code>A B</code></label>
<def><p><code>A</code>の次に<code>B</code>が出現するものと&match;する。
</p></def>
</gitem>
<gitem>
<label><code>A | B</code></label>
<def><p><code>A</code>又は<code>B</code>,ただし,両方ではない,と&match;する。
</p></def>
</gitem>
<gitem>
<label><code>A - B</code></label>
<def><p><code>A</code>と&match;するが,<code>B</code>とは&match;しない,任意の&string;と&match;する。</p></def>
</gitem>
<gitem>
<label><code>A+</code></label>
<def><p><code>A</code>の1回以上の繰返しと&match;する。</p></def>
</gitem>
<gitem>
<label><code>A*</code></label>
<def><p><code>A</code>の0回以上の繰返しと&match;する。</p></def>
</gitem>
<!-- DEATH TO %'s
<gitem>
<label><code>%a</code></label>
<def><p>specifies that <emph>in the external DTD subset</emph> a
<termref def='dt-param-entity'>parameter entity</termref> may occur in the
text at the position where <code>a</code> may occur; if so, its
replacement text must match <code>S? a S?</code>. If
the expression <code>a</code> is governed by a suffix operator, then
the suffix operator determines both the maximum number of parameter-entity
references allowed and the number of occurrences of <code>a</code>
in the replacement text of the parameter entities: <code>%a*</code>
means that <code>a</code> must occur zero or more times, and
that some of its occurrences may be replaced by references to
parameter entities whose replacement text must contain zero or
more occurrences of <code>a</code>; it is thus a more compact way
of writing <code>%(a*)*</code>.
Similarly, <code>%a+</code> means that <code>a</code>
must occur one or more times, and may be replaced by
parameter entities with replacement text matching
<code>S? (a S?)+</code>.
The recognition of parameter entities in the internal subset is much more
highly constrained.
</p></def>
</gitem>
-->
</glist>
生成規則内で使用する他の記法を,次に示す。
<glist>
<gitem>
<label><code>/* ... */</code></label>
<def><p>コメント。</p></def>
</gitem>
<gitem>
<label><code>[ wfc: ... ]</code></label>
<def><p>&well-formed;制約。生成規則に付与した,<termref def="dt-wellformed">&well-formed;</termref>の文書に関する制約を,名前によって&identify;。</p></def>
</gitem>
<gitem>
<label><code>[ vc: ... ]</code></label>
<def><p>&validity;制約。生成規則に付与した,<termref def="dt-valid">&valid;</termref>な文書に関する制約を,名前によって&identify;。
</p></def>
</gitem>
</glist>
</p></div1>
</body>
<back>
<!-- &SGML; -->
<!-- &Biblio; -->
<div1 id='sec-bibliography'>
<head>参考文献</head>
<div2 id='sec-existing-stds'>
<head>&normative;参考文献</head>
<!--* <ulist><item>
<p>Unicode and ISO/IEC 10646. This specification depends on the
international standard ISO/IEC 10646 (with amendments AM 1 through AM 7)
and the Unicode Standard, Version 2.0 <bibref ref='Unicode'/>,
which define the encodings and meanings of
the <termref def="dt-character">characters</termref> which
make up XML <termref def="dt-text">text</termref>.
All the characters in ISO/IEC 10646 are present, at the same code points,
in Unicode.</p></item>
<item><p>XXX XXX defines the syntax and semantics of
Uniform Resource Identifiers, or URIs.</p></item>
<item><p>IETF RFC 1766, with ISO 639 and 3166,
describe the codes that may be used in the
special <titleref href='sec-lang-tag'>xml:lang</titleref> attribute.</p>
</item></ulist>
*-->
<blist>
<bibl id='RFC1766' key='IETF RFC 1766'>
IETF (Internet Engineering Task Force).
<emph>RFC 1766: Tags for the Identification of Languages</emph>,
ed. H. Alvestrand.
1995.
</bibl>
<bibl id='ISO639' key='ISO 639'>
(International Organization for Standardization).
<emph>ISO 8879:1988 (E).
Code for the representation of names of languages.</emph>
[Geneva]: International Organization for
Standardization, 1988.</bibl>
<bibl id='ISO3166' key='ISO 3166'>
(International Organization for Standardization).
<emph>ISO 3166-1:1997 (E).
Codes for the representation of names of countries and their subdivisions
&mdash; Part 1: Country codes</emph>
[Geneva]: International Organization for
Standardization, 1997.</bibl>
<bibl id='ISO10646' key='ISO/IEC 10646'>ISO
(International Organization for Standardization).
<emph>ISO/IEC 10646-1993 (E). Information technology &mdash; Universal
Multiple-Octet Coded Character Set (UCS) &mdash; Part 1:
Architecture and Basic Multilingual Plane.</emph>
[Geneva]: International Organization for
Standardization, 1993 (plus amendments AM 1 through AM 7).
</bibl>
<bibl id='Unicode' key='Unicode'>The Unicode Consortium.
<emph>The Unicode Standard, Version 2.0.</emph>
Reading, Mass.: Addison-Wesley Developers Press, 1996.</bibl>
</blist>
</div2>
<div2><head>他の参考文献</head>
<blist>
<bibl id='Aho' key='Aho/Ullman'>Aho, Alfred V.,
Ravi Sethi, and Jeffrey D. Ullman.
<emph>Compilers: Principles, Techniques, and Tools</emph>.
Reading: Addison-Wesley, 1986, rpt. corr. 1988.</bibl>
<bibl id="Berners-Lee" key="Berners-Lee et al.">
Berners-Lee, T., R. Fielding, and L. Masinter.
<emph>Uniform Resource Identifiers (URI): Generic Syntax and
Semantics</emph>.
1997.
(Work in progress; see updates to RFC1738.)</bibl>
<bibl id='ABK' key='Br&#252;ggemann-Klein'>Br&#252;ggemann-Klein, Anne.
<emph>Regular Expressions into Finite Automata</emph>.
Extended abstract in I. Simon, Hrsg., LATIN 1992,
S. 97-98. Springer-Verlag, Berlin 1992.
Full Version in Theoretical Computer Science 120: 197-213, 1993.
<!--
Universitat Freiburg, Institut fur Informatik,
Bericht 33, Juli 1991.-->
</bibl>
<bibl id='ABKDW' key='Br&#252;ggemann-Klein and Wood'>Br&#252;ggemann-Klein, Anne,
and Derick Wood.
<emph>Deterministic Regular Languages</emph>.
Universit&#228;t Freiburg, Institut f&#252;r Informatik,
Bericht 38, Oktober 1991.
</bibl>
<bibl id="RFC1738" key="IETF RFC1738">
IETF (Internet Engineering Task Force).
<emph>RFC 1738: Uniform Resource Locators (URL)</emph>,
ed. T. Berners-Lee, L. Masinter, M. McCahill.
1994.
</bibl>
<bibl id="RFC1808" key="IETF RFC1808">
IETF (Internet Engineering Task Force).
<emph>RFC 1808: Relative Uniform Resource Locators</emph>,
ed. R. Fielding.
1995.
</bibl>
<bibl id="RFC2141" key="IETF RFC2141">
IETF (Internet Engineering Task Force).
<emph>RFC 2141: URN Syntax</emph>,
ed. R. Moats.
1997.
</bibl>
<bibl id='ISO8879' key='ISO/IEC 8879'>ISO
(International Organization for Standardization).
<emph>ISO/IEC 8879-1986 (E). Information processing &mdash; Text and Office
Systems &mdash; Standard Generalized Markup Language (SGML).</emph> First
edition &mdash; 1986-10-15. [Geneva]: International Organization for
Standardization, 1986.
</bibl>
<bibl id='ISO10744' key='ISO/IEC 10744'>ISO
(International Organization for Standardization).
<emph>ISO/IEC 10744-1992 (E). Information technology &mdash;
Hypermedia/Time-based Structuring Language (HyTime).
</emph>
[Geneva]: International Organization for
Standardization, 1992.
<emph>Extended Facilities Annexe.</emph>
[Geneva]: International Organization for
Standardization, 1996.
</bibl>
</blist>
</div2>
</div1>
<div1 id='CharClasses'>
<head>文字クラス</head>
<p>Unicode標準に定義する&property;にしたがって,文字は,&base-character;(BaseChar)(これらは,&diacritical-mark;を除くラテンアルファベットのアルファベット文字を含む),&ideographic;(ideographic)及び&combining-character;(CombiningChar)(このクラスは,ほとんどの&diacritical-mark;を含む)にクラス分けする。これらのクラスは,結合し,&letter;(Letter)のクラスとなる。10進数値(Digit)及び&extender;(Extender)も区別する。
<scrap lang="ebnf" id="CHARACTERS">
<head>文字</head>
<prodgroup pcw3="3" pcw4="15">
<prod id="NT-Letter"><lhs>Letter</lhs>
<rhs><nt def="NT-BaseChar">BaseChar</nt>
| <nt def="NT-Ideographic">Ideographic</nt></rhs> </prod>
<prod id='NT-BaseChar'><lhs>BaseChar</lhs>
<rhs>[#x0041-#x005A]
|&nbsp;[#x0061-#x007A]
|&nbsp;[#x00C0-#x00D6]
|&nbsp;[#x00D8-#x00F6]
|&nbsp;[#x00F8-#x00FF]
|&nbsp;[#x0100-#x0131]
|&nbsp;[#x0134-#x013E]
|&nbsp;[#x0141-#x0148]
|&nbsp;[#x014A-#x017E]
|&nbsp;[#x0180-#x01C3]
|&nbsp;[#x01CD-#x01F0]
|&nbsp;[#x01F4-#x01F5]
|&nbsp;[#x01FA-#x0217]
|&nbsp;[#x0250-#x02A8]
|&nbsp;[#x02BB-#x02C1]
|&nbsp;#x0386
|&nbsp;[#x0388-#x038A]
|&nbsp;#x038C
|&nbsp;[#x038E-#x03A1]
|&nbsp;[#x03A3-#x03CE]
|&nbsp;[#x03D0-#x03D6]
|&nbsp;#x03DA
|&nbsp;#x03DC
|&nbsp;#x03DE
|&nbsp;#x03E0
|&nbsp;[#x03E2-#x03F3]
|&nbsp;[#x0401-#x040C]
|&nbsp;[#x040E-#x044F]
|&nbsp;[#x0451-#x045C]
|&nbsp;[#x045E-#x0481]
|&nbsp;[#x0490-#x04C4]
|&nbsp;[#x04C7-#x04C8]
|&nbsp;[#x04CB-#x04CC]
|&nbsp;[#x04D0-#x04EB]
|&nbsp;[#x04EE-#x04F5]
|&nbsp;[#x04F8-#x04F9]
|&nbsp;[#x0531-#x0556]
|&nbsp;#x0559
|&nbsp;[#x0561-#x0586]
|&nbsp;[#x05D0-#x05EA]
|&nbsp;[#x05F0-#x05F2]
|&nbsp;[#x0621-#x063A]
|&nbsp;[#x0641-#x064A]
|&nbsp;[#x0671-#x06B7]
|&nbsp;[#x06BA-#x06BE]
|&nbsp;[#x06C0-#x06CE]
|&nbsp;[#x06D0-#x06D3]
|&nbsp;#x06D5
|&nbsp;[#x06E5-#x06E6]
|&nbsp;[#x0905-#x0939]
|&nbsp;#x093D
|&nbsp;[#x0958-#x0961]
|&nbsp;[#x0985-#x098C]
|&nbsp;[#x098F-#x0990]
|&nbsp;[#x0993-#x09A8]
|&nbsp;[#x09AA-#x09B0]
|&nbsp;#x09B2
|&nbsp;[#x09B6-#x09B9]
|&nbsp;[#x09DC-#x09DD]
|&nbsp;[#x09DF-#x09E1]
|&nbsp;[#x09F0-#x09F1]
|&nbsp;[#x0A05-#x0A0A]
|&nbsp;[#x0A0F-#x0A10]
|&nbsp;[#x0A13-#x0A28]
|&nbsp;[#x0A2A-#x0A30]
|&nbsp;[#x0A32-#x0A33]
|&nbsp;[#x0A35-#x0A36]
|&nbsp;[#x0A38-#x0A39]
|&nbsp;[#x0A59-#x0A5C]
|&nbsp;#x0A5E
|&nbsp;[#x0A72-#x0A74]
|&nbsp;[#x0A85-#x0A8B]
|&nbsp;#x0A8D
|&nbsp;[#x0A8F-#x0A91]
|&nbsp;[#x0A93-#x0AA8]
|&nbsp;[#x0AAA-#x0AB0]
|&nbsp;[#x0AB2-#x0AB3]
|&nbsp;[#x0AB5-#x0AB9]
|&nbsp;#x0ABD
|&nbsp;#x0AE0
|&nbsp;[#x0B05-#x0B0C]
|&nbsp;[#x0B0F-#x0B10]
|&nbsp;[#x0B13-#x0B28]
|&nbsp;[#x0B2A-#x0B30]
|&nbsp;[#x0B32-#x0B33]
|&nbsp;[#x0B36-#x0B39]
|&nbsp;#x0B3D
|&nbsp;[#x0B5C-#x0B5D]
|&nbsp;[#x0B5F-#x0B61]
|&nbsp;[#x0B85-#x0B8A]
|&nbsp;[#x0B8E-#x0B90]
|&nbsp;[#x0B92-#x0B95]
|&nbsp;[#x0B99-#x0B9A]
|&nbsp;#x0B9C
|&nbsp;[#x0B9E-#x0B9F]
|&nbsp;[#x0BA3-#x0BA4]
|&nbsp;[#x0BA8-#x0BAA]
|&nbsp;[#x0BAE-#x0BB5]
|&nbsp;[#x0BB7-#x0BB9]
|&nbsp;[#x0C05-#x0C0C]
|&nbsp;[#x0C0E-#x0C10]
|&nbsp;[#x0C12-#x0C28]
|&nbsp;[#x0C2A-#x0C33]
|&nbsp;[#x0C35-#x0C39]
|&nbsp;[#x0C60-#x0C61]
|&nbsp;[#x0C85-#x0C8C]
|&nbsp;[#x0C8E-#x0C90]
|&nbsp;[#x0C92-#x0CA8]
|&nbsp;[#x0CAA-#x0CB3]
|&nbsp;[#x0CB5-#x0CB9]
|&nbsp;#x0CDE
|&nbsp;[#x0CE0-#x0CE1]
|&nbsp;[#x0D05-#x0D0C]
|&nbsp;[#x0D0E-#x0D10]
|&nbsp;[#x0D12-#x0D28]
|&nbsp;[#x0D2A-#x0D39]
|&nbsp;[#x0D60-#x0D61]
|&nbsp;[#x0E01-#x0E2E]
|&nbsp;#x0E30
|&nbsp;[#x0E32-#x0E33]
|&nbsp;[#x0E40-#x0E45]
|&nbsp;[#x0E81-#x0E82]
|&nbsp;#x0E84
|&nbsp;[#x0E87-#x0E88]
|&nbsp;#x0E8A
|&nbsp;#x0E8D
|&nbsp;[#x0E94-#x0E97]
|&nbsp;[#x0E99-#x0E9F]
|&nbsp;[#x0EA1-#x0EA3]
|&nbsp;#x0EA5
|&nbsp;#x0EA7
|&nbsp;[#x0EAA-#x0EAB]
|&nbsp;[#x0EAD-#x0EAE]
|&nbsp;#x0EB0
|&nbsp;[#x0EB2-#x0EB3]
|&nbsp;#x0EBD
|&nbsp;[#x0EC0-#x0EC4]
|&nbsp;[#x0F40-#x0F47]
|&nbsp;[#x0F49-#x0F69]
|&nbsp;[#x10A0-#x10C5]
|&nbsp;[#x10D0-#x10F6]
|&nbsp;#x1100
|&nbsp;[#x1102-#x1103]
|&nbsp;[#x1105-#x1107]
|&nbsp;#x1109
|&nbsp;[#x110B-#x110C]
|&nbsp;[#x110E-#x1112]
|&nbsp;#x113C
|&nbsp;#x113E
|&nbsp;#x1140
|&nbsp;#x114C
|&nbsp;#x114E
|&nbsp;#x1150
|&nbsp;[#x1154-#x1155]
|&nbsp;#x1159
|&nbsp;[#x115F-#x1161]
|&nbsp;#x1163
|&nbsp;#x1165
|&nbsp;#x1167
|&nbsp;#x1169
|&nbsp;[#x116D-#x116E]
|&nbsp;[#x1172-#x1173]
|&nbsp;#x1175
|&nbsp;#x119E
|&nbsp;#x11A8
|&nbsp;#x11AB
|&nbsp;[#x11AE-#x11AF]
|&nbsp;[#x11B7-#x11B8]
|&nbsp;#x11BA
|&nbsp;[#x11BC-#x11C2]
|&nbsp;#x11EB
|&nbsp;#x11F0
|&nbsp;#x11F9
|&nbsp;[#x1E00-#x1E9B]
|&nbsp;[#x1EA0-#x1EF9]
|&nbsp;[#x1F00-#x1F15]
|&nbsp;[#x1F18-#x1F1D]
|&nbsp;[#x1F20-#x1F45]
|&nbsp;[#x1F48-#x1F4D]
|&nbsp;[#x1F50-#x1F57]
|&nbsp;#x1F59
|&nbsp;#x1F5B
|&nbsp;#x1F5D
|&nbsp;[#x1F5F-#x1F7D]
|&nbsp;[#x1F80-#x1FB4]
|&nbsp;[#x1FB6-#x1FBC]
|&nbsp;#x1FBE
|&nbsp;[#x1FC2-#x1FC4]
|&nbsp;[#x1FC6-#x1FCC]
|&nbsp;[#x1FD0-#x1FD3]
|&nbsp;[#x1FD6-#x1FDB]
|&nbsp;[#x1FE0-#x1FEC]
|&nbsp;[#x1FF2-#x1FF4]
|&nbsp;[#x1FF6-#x1FFC]
|&nbsp;#x2126
|&nbsp;[#x212A-#x212B]
|&nbsp;#x212E
|&nbsp;[#x2180-#x2182]
|&nbsp;[#x3041-#x3094]
|&nbsp;[#x30A1-#x30FA]
|&nbsp;[#x3105-#x312C]
|&nbsp;[#xAC00-#xD7A3]
</rhs></prod>
<prod id='NT-Ideographic'><lhs>Ideographic</lhs>
<rhs>[#x4E00-#x9FA5]
|&nbsp;#x3007
|&nbsp;[#x3021-#x3029]
</rhs></prod>
<prod id='NT-CombiningChar'><lhs>CombiningChar</lhs>
<rhs>[#x0300-#x0345]
|&nbsp;[#x0360-#x0361]
|&nbsp;[#x0483-#x0486]
|&nbsp;[#x0591-#x05A1]
|&nbsp;[#x05A3-#x05B9]
|&nbsp;#x05BB#x05BD
|&nbsp;#x05BF
|&nbsp;[#x05C1-#x05C2]
|&nbsp;#x05C4
|&nbsp;#x064B#x0652
|&nbsp;#x0670
|&nbsp;[#x06D6-#x06DC]
|&nbsp;#x06DD#x06DF
|&nbsp;[#x06E0-#x06E4]
|&nbsp;[#x06E7-#x06E8]
|&nbsp;[#x06EA-#x06ED]
|&nbsp;[#x0901-#x0903]
|&nbsp;#x093C
|&nbsp;[#x093E-#x094C]
|&nbsp;#x094D
|&nbsp;[#x0951-#x0954]
|&nbsp;[#x0962-#x0963]
|&nbsp;[#x0981-#x0983]
|&nbsp;#x09BC
|&nbsp;#x09BE
|&nbsp;#x09BF
|&nbsp;[#x09C0-#x09C4]
|&nbsp;[#x09C7-#x09C8]
|&nbsp;[#x09CB-#x09CD]
|&nbsp;#x09D7
|&nbsp;[#x09E2-#x09E3]
|&nbsp;#x0A02
|&nbsp;#x0A3C
|&nbsp;#x0A3E
|&nbsp;#x0A3F
|&nbsp;[#x0A40-#x0A42]
|&nbsp;[#x0A47-#x0A48]
|&nbsp;[#x0A4B-#x0A4D]
|&nbsp;[#x0A70-#x0A71]
|&nbsp;[#x0A81-#x0A83]
|&nbsp;#x0ABC
|&nbsp;[#x0ABE-#x0AC5]
|&nbsp;[#x0AC7-#x0AC9]
|&nbsp;[#x0ACB-#x0ACD]
|&nbsp;[#x0B01-#x0B03]
|&nbsp;#x0B3C
|&nbsp;[#x0B3E-#x0B43]
|&nbsp;[#x0B47-#x0B48]
|&nbsp;[#x0B4B-#x0B4D]
|&nbsp;[#x0B56-#x0B57]
|&nbsp;[#x0B82-#x0B83]
|&nbsp;[#x0BBE-#x0BC2]
|&nbsp;[#x0BC6-#x0BC8]
|&nbsp;[#x0BCA-#x0BCD]
|&nbsp;#x0BD7
|&nbsp;[#x0C01-#x0C03]
|&nbsp;[#x0C3E-#x0C44]
|&nbsp;[#x0C46-#x0C48]
|&nbsp;[#x0C4A-#x0C4D]
|&nbsp;[#x0C55-#x0C56]
|&nbsp;[#x0C82-#x0C83]
|&nbsp;[#x0CBE-#x0CC4]
|&nbsp;[#x0CC6-#x0CC8]
|&nbsp;[#x0CCA-#x0CCD]
|&nbsp;[#x0CD5-#x0CD6]
|&nbsp;[#x0D02-#x0D03]
|&nbsp;[#x0D3E-#x0D43]
|&nbsp;[#x0D46-#x0D48]
|&nbsp;[#x0D4A-#x0D4D]
|&nbsp;#x0D57
|&nbsp;#x0E31
|&nbsp;[#x0E34-#x0E3A]
|&nbsp;[#x0E47-#x0E4E]
|&nbsp;#x0EB1
|&nbsp;[#x0EB4-#x0EB9]
|&nbsp;[#x0EBB-#x0EBC]
|&nbsp;[#x0EC8-#x0ECD]
|&nbsp;[#x0F18-#x0F19]
|&nbsp;#x0F35
|&nbsp;#x0F37
|&nbsp;#x0F39
|&nbsp;#x0F3E
|&nbsp;#x0F3F
|&nbsp;[#x0F71-#x0F84]
|&nbsp;[#x0F86-#x0F8B]
|&nbsp;[#x0F90-#x0F95]
|&nbsp;#x0F97
|&nbsp;[#x0F99-#x0FAD]
|&nbsp;[#x0FB1-#x0FB7]
|&nbsp;#x0FB9
|&nbsp;[#x20D0-#x20DC]
|&nbsp;#x20E1
|&nbsp;[#x302A-#x302F]
|&nbsp;#x3099
|&nbsp;#x309A
</rhs></prod>
<prod id='NT-Digit'><lhs>Digit</lhs>
<rhs>[#x0030-#x0039]
|&nbsp;[#x0660-#x0669]
|&nbsp;[#x06F0-#x06F9]
|&nbsp;[#x0966-#x096F]
|&nbsp;[#x09E6-#x09EF]
|&nbsp;[#x0A66-#x0A6F]
|&nbsp;[#x0AE6-#x0AEF]
|&nbsp;[#x0B66-#x0B6F]
|&nbsp;[#x0BE7-#x0BEF]
|&nbsp;[#x0C66-#x0C6F]
|&nbsp;[#x0CE6-#x0CEF]
|&nbsp;[#x0D66-#x0D6F]
|&nbsp;[#x0E50-#x0E59]
|&nbsp;[#x0ED0-#x0ED9]
|&nbsp;[#x0F20-#x0F29]
</rhs></prod>
<prod id='NT-Extender'><lhs>Extender</lhs>
<rhs>#x00B7
|&nbsp;#x02D0
|&nbsp;#x02D1
|&nbsp;#x0387
|&nbsp;#x0640
|&nbsp;#x0E46
|&nbsp;#x0EC6
|&nbsp;#x3005
|&nbsp;[#x3031-#x3035]
|&nbsp;[#x309D-#x309E]
|&nbsp;[#x30FC-#x30FE]
</rhs></prod>
</prodgroup>
</scrap>
</p>
<p>ここで定義する文字クラスは,Unicode文字データベースから,次のとおりに得ることができる。
<ulist>
<item>
<p>a) 名前開始文字は,Ll, Lu, Lo, Lt, Nlカテゴリ内の一つでなければならない。</p>
</item>
<item>
<p>b) 名前開始文字以外の名前文字は,Mc, Me, Mn, Lm, Ndカテゴリ内の一つでなければならない。</p>
</item>
<item>
<p>c) &compatibility-area;にある文字(文字符号で#xF900より大きく#xFFFEより小さい文字)は,XMLにおける名前としては,許されない。</p>
</item>
<item>
<p>d) &font-decomposition;か&compatibility-decomposition;をもつ文字(つまり,データベース内の5番目のフィールドに"compatibility formatting tag"があるもの。これは,5番目のフィールドが,"&lt;"で始まることによってマーク付けされる。)は,許されない。</p>
</item>
<item>
<p>e) 次の文字は,名前開始文字として扱う。これは,&property-file;が,これらの文字をアルファベットに類似すると見なすことによる。それらは
[#x02BB-#x02C1], #x0559, #x06E5, #x06E6とする。</p>
</item>
<item>
<p>f) 文字符号が#x20DD-#x20E0の文字は,(Unicode の5.14にしたがって)除外する。</p>
</item>
<item>
<p>g) 文字符号が#x00B7の文字は,&property-list;にしたがって,&extender;(extender)に分類する。</p>
</item>
<item>
<p>h) 文字#x0387は,これに相当する正規形が#x00B7なので,名前文字に追加する。</p>
</item>
<item>
<p>i) 文字':'及び'_'は,名前開始文字として許す。</p>
</item>
<item>
<p>j) 文字'-'及び'.'は,名前文字として許す。</p>
</item>
</ulist>
</p>
</div1>
<inform-div1 id="sec-xml-and-sgml">
<head>XML及びSGML</head>
<p>XMLは,SGMLの&subset;として設計されている。すなわち,すべての<termref def="dt-valid">&valid;</termref>なXML文書は,規格に適合するSGML文書にもなる。SGMLが文書に課す制限以外に,XMLがいかなる制限を課すかに関する詳細は,別の<loc href='http://www.w3.org/TR/NOTE-sgml-xml'>規程</loc>を参照のこと。この規程は,XMLの制約条件を示すSGML宣言を含み,これは,SGML&parser;に使用できる。
</p>
</inform-div1>
<inform-div1 id="sec-entexpand">
<head>実体参照及び文字参照の展開</head>
<p>この付録は,実体参照及び文字参照を認識し,展開する,一連の流れを,例に使って示す。</p>
<p>
DTDが,次の宣言を含む場合を考える。
<eg><![CDATA[<!ENTITY example "<p>An ampersand (&#38;#38;) may be escaped
numerically (&#38;#38;#38;) or with a general entity
(&amp;amp;).</p>" >
]]></eg>
XML&processor;は,実体の宣言を構文解析した時点で文字参照を認識し,これを解決する。実体"<code>example</code>"の値として,次の&string;を保存する。
<eg><![CDATA[<p>An ampersand (&#38;) may be escaped
numerically (&#38;#38;) or with a general entity
(&amp;amp;).</p>
]]></eg>
文書内で"<code>&amp;example;</code>"を参照すると,このテキストは,再び構文解析される。このとき,要素"<code>p</code>"の開始タグ及び終了タグを認識し,三つの参照を認識し展開する。その結果,要素"<code>p</code>"は,次の内容をもつ(すべてデータとし,区切り子又は&markup;は存在しない。)。
<eg><![CDATA[An ampersand (&) may be escaped
numerically (&#38;) or with a general entity
(&amp;).
]]></eg>
</p>
<p>規則及びその効果をより詳細に示すため,さらに複雑な例を示す。次の例で,行番号は,参照の便宜のためだけに付ける。
<eg><![CDATA[1 <?xml version='1.0'?>
2 <!DOCTYPE test [
3 <!ELEMENT test (#PCDATA) >
4 <!ENTITY % xx '&#37;zz;'>
5 <!ENTITY % zz '&#60;!ENTITY tricky "error-prone" >' >
6 %xx;
7 ]>
8 <test>This sample shows a &tricky; method.</test>
]]></eg>
これを処理すると,次のとおりとなる。
<ulist spacing="compact">
<item><p>a) 4行目で,37番目の文字への参照を直ちに展開し,パラメタ実体"<code>xx</code>"を,シンボルテーブルに"<code>%zz;</code>"という値とともに保存する。&replacement-text;を再び走査することはないので,パラメタ実体"<code>zz</code>"への参照は認識しない("<code>zz</code>"は,まだ宣言されていないので,走査されれば,&error;となる。)。</p></item>
<item><p>b) 5行目で,文字参照"<code>&amp;#60;</code>"を直ちに展開し,パラメタ実体"<code>zz</code>"を"<code>&lt;!ENTITY tricky "error-prone" ></code>"という&replacement-text;とともに保存する。これは,&well-formed;の実体宣言とする。</p></item>
<item><p>c) 6行目で,"<code>xx</code>"への参照を認識し,"<code>xx</code>"の&replacement-text;(すなわち,"<code>%zz;</code>")を構文解析する。"<code>zz</code>"への参照を続いて認識し,&replacement-text;("<code>&lt;!ENTITY tricky "error-prone" ></code>")を構文解析する。一般実体"<code>tricky</code>"は,この時点では,宣言されており,その&replacement-text;は,"<code>error-prone</code>"とする。 </p></item>
<item><p>d) 8行目で,一般実体"<code>tricky</code>"への参照を認識し,展開する。要素"<code>test</code>"の完全な内容は,次の(内容をそれ自体表現する。)&string;となる。つまり,<emph>This sample shows a error-prone method.</emph>
</p></item>
</ulist>
</p>
</inform-div1>
<inform-div1 id="determinism">
<head>決定的内容モデル</head>
<p><termref def='dt-compat'>互換性のため</termref>,要素宣言における内容モデルは,決定的とする必要がある。
</p>
<!-- FINAL EDIT: WebSGML allows ambiguity? -->
<p>SGMLは,決定的内容モデル(SGMLでは,非あいまいと呼ぶ。)を要求する。SGMLシステムを用いて作成したXML&processor;は,非決定的内容モデルを&error;としてもよい。</p>
<p>例えば,内容モデル<code>((b, c) | (b, d))</code>は非決定的となる。これは,最初に<code>b</code>を与えたとき,モデル内のいずれの<code>b</code>と&match;するのが望ましいか,その次の要素を先読みすることなしには,&parser;は知ることができないことによる。この場合は,<code>b</code>への二つの参照は,一つの参照にまとめることができ,モデルは,<code>(b, (c | d))</code>となる。これで,最初の<code>b</code>が,内容モデル内の一つの名前とだけ&match;することは明らかとなる。&parser;は,先読みして,次に来るものを知る必要がない。<code>c</code><code>d</code>も,受理される。</p>
<p>形式的に示す。Aho, Sethi, and Ullman <bibref ref='Aho'/>の3.9のアルゴリズム3.5の標準的なアルゴリズムを用いて,内容モデルから有限オートマトンを構成することができる。この種の多くのアルゴリズムでは,正規表現における各々の位置(つまり,正規表現の構文木における各々の末端ノード)に対して,follow set(次にどの位置に移動可能かを表すもの)を構成する。ある位置に対するfollow setにおいて,複数の位置が同じ要素型名でラベル付けされていれば,その内容モデルは&error;となり,&error;を返す場合もある。
</p>
<p>すべての非決定的内容モデルを等価な決定的内容モデルに変換することはできないが,多くの非決定的内容モデルを変換するアルゴリズムが存在する。Br&#252;ggemann-Klein 1991 <bibref ref='ABK'/>を参照のこと。</p>
</inform-div1>
<inform-div1 id="sec-guessing">
<head>文字符号化の自動検出</head>
<p>
XMLの符号化宣言は,各実体の内部ラベルとして機能し,どの文字符号化を使用するかを示す。しかし,XML&processor;は,内部ラベルを読む前に,どの文字符号化を使用するかを知る必要があり,これが,内部ラベルが示そうとすることになる。一般的には,これは,絶望的な状態となる。しかし,XMLにおいては,完全には絶望的ではない。これは,XMLが,次の二つの点で一般的な場合に対する制限を加えることによる。一つの制限は,どの実装も有限個の文字符号化だけのサポートを想定することとする。他の一つの制限は,各実体で使用する文字符号化を自動検出可能とする,XMLの符号化宣言の位置及び内容に関する制限とする。多くの場合に,XMLのデータストリームに加え,他の情報が利用できる。ここでは,XMLの実体が&processor;に渡されるとき,(外部)情報を伴うかどうかによって,二つの場合に分ける。まず最初の場合を示す。</p>
<p>
UTF-8形式又はUTF-16形式ではないXML実体は,最初の文字を‘<code>&lt;?xml</code>'とするXML符号化宣言で始まら<emph>なければならない</emph>ので,どの適合した&processor;も,入力にある2オクテット又は4オクテットを調べれば,次のどの場合があてはまるかを検出できる。このリストを読む際には,UCS-4の'&lt;'が"<code>#x0000003C</code>",'?'が"<code>#x0000003F</code>",及びUTF-16のデータ&stream;の必要とする&byte-order-mark;が"<code>#xFEFF</code>"ということを知っておくと役立つかもしれない。</p>
<p>
<ulist>
<item>
<p>a) <code>00 00 00 3C</code>: UCS-4, big-endian マシン (1234順)</p>
</item>
<item>
<p>b) <code>3C 00 00 00</code>: UCS-4, little-endian マシン (4321順)</p>
</item>
<item>
<p>c) <code>00 00 3C 00</code>: UCS-4, 普通ではないオクテット順 (2143)</p>
</item>
<item>
<p>d) <code>00 3C 00 00</code>: UCS-4, 普通ではないオクテット順 (3412)</p>
</item>
<item>
<p>e) <code>FE FF</code>: UTF-16, big-endian</p>
</item>
<item>
<p>f) <code>FF FE</code>: UTF-16, little-endian</p>
</item>
<item>
<p>g) <code>00 3C 00 3F</code>: UTF-16, big-endian, &byte-order-mark;なし(したがって,厳密にいえば,&error;とする。)。</p>
</item>
<item>
<p>h) <code>3C 00 3F 00</code>: UTF-16, little-endian, &byte-order-mark;なし(したがって,厳密にいえば,&error;とする。)。</p>
</item>
<item>
<p>i) <code>3C 3F 78 6D</code>: UTF-8, ISO 646, ASCII, ISO 8859の各パート,Shift-JIS,EUC,並びに任意の他の7ビット,8ビット又は混在幅の符号化であって,ASCII文字を通常の位置,幅及び値とすることを保証するもの。これらのどれに対応するかを検出するためには,実際の符号化宣言を読み込まなければならない。しかし,これらすべての符号化は,ASCII文字に対して同じビットパターンを使用するので,符号化宣言自体は,正確に読込み可能とする。
</p>
</item>
<item>
<p>j) <code>4C 6F A7 94</code>: EBCDIC (又はその変種。どのコードページを使用するかを知るためには,符号化宣言全体を読み込まれなければならない。)</p>
</item>
<item>
<p>k) その他: 符号化宣言なしのUTF-8。そうでないときには,データ&stream;が壊れているか,断片的になっているか,何らかの形式にしたがって埋め込まれている。</p>
</item>
</ulist>
</p>
<p>
この程度の自動判別でも,XMLの符号化宣言を読み込み,文字符号化の&identifier;を解析するには十分とする。&identifier;の解析は,類似する各々の符号化の一つ一つを区別するために必要とする(例えば,UTF-8及び8859を区別するため,8859の各パートを区別するため,使用している特定のEBCDICコードページを区別するため,など。)。
</p>
<p>
符号化宣言の内容をASCII文字に限定しているので,どの分類の符号化を使用するかを検出すれば,&processor;は,符号化宣言全体を正確に読み込むことができる。現実問題として,広く使用されている文字符号化は,上の分類のいずれかにあてはまるので,オペレーティングシステム又は伝送プロトコルが与える外部情報を信頼不可能なときでさえも,内部ラベルで文字符号化をかなり正確に示すことが,XML符号化宣言によって可能となる。
</p>
<p>
&processor;が使用する文字符号化を検出しさえすれば,それぞれの場合に対して別個の入力ルーチンを呼び出す,又は入力する各文字に対し適切な変換関数を呼び出すことによって,適切な動作が可能となる。</p>
<p>
自分自体にラベル付けをするいかなるシステムでも同様だが,ソフトウェアが,符号化宣言を更新せずに実体の文字集合又は符号化を変えたならば,XMLの符号化宣言は,機能しない。文字符号化ルーチンの実装者は,実体のラベル付けに使用する内部及び外部の情報の正確さの保証に注意するのが望ましい。
</p>
<p>2番目の場合は,XMLの実体の他に,符号化情報が存在するときであって,いくつかのファイルシステム及びネットワークプロトコルでは,その符号化情報が存在する。複数の情報が利用できるとき,<!-- (e.g. both the
internal encoding declaration and an external label), -->それらの相対的な優先度及びそれらが矛盾したときの望ましい処理方法は,XMLの配送に使用する,より高水準のプロトコルの一部として規程するのがよい。例えば,内部ラベル及び外部&header;に存在するMIME形式のラベルの相対的な優先度に対する規則は,text/xml及びapplication/xmlのMIME型を定義するRFC文書の一部となる方がよい。しかし,相互運用性のために,次の規則に従うことが望ましい。
<ulist>
<item><p>a) XMLの実体がファイルに存在すれば,&byte-order-mark;及び符号化宣言PIは,(存在すれば)文字符号化を決定するために使用する。他のすべての&hueristics;及び情報は,&error;回復のためだけに用いる。
</p></item>
<item><p>b) XMLの実体をMIME型text/xmlで配送するときは,このMIME型のもつcharsetパラメタが文字符号化方法を決定する。他のすべての&hueristics;及び情報は,&error;回復のためだけに用いる。
</p></item>
<item><p>c) XMLの実体を <!-- via the HTTP protocol -->MIME型application/xmlで配送するときは,&byte-order-mark;及び符号化宣言PIを(存在すれば)文字符号化の決定のために使用する。他のすべての&hueristics;及び情報は&error;回復のためだけに用いる。
</p></item>
</ulist>
これらの規則は,プロトコルについての資料がないときにだけ用いる。特に,MIME型text/xml及びapplication/xmlを定義したら,これらを規定するRFCに存在する規定が,これらの規則に取って代わる。
</p>
</inform-div1>
<!--
<div1 id='sec-trival-grammar'>
<head>A Trivial Grammar for XML Documents</head>
<p>The grammar given in the body of this specification is relatively
simple, but for some purposes it is convenient to have an even simpler
one.
A very simple, though non-conforming, <termref def="dt-xml-proc">XML
processor</termref> could parse a <termref
def="dt-wellformed">well-formed</termref> XML document using the
following simplified grammar, recognizing all element boundaries
correctly, though not expanding entity references and not detecting
all errors:
<scrap lang="ebnf">
<head>Trivial text grammar</head>
<prodgroup pcw2="5.5" pcw4="17" pcw5="10">
<prod id='NT-simpleDoc'><lhs>simpleDoc</lhs>
<rhs>(<nt def='NT-SimpleData'>SimpleData</nt>
| <nt def='NT-Markup'>Markup</nt>)*</rhs></prod>
<prod id="NT-SimpleData"><lhs>SimpleData</lhs>
<rhs>[^&lt;&amp;]*</rhs>
<com>cf. PCData</com>
</prod>
<prod id="NT-SimpleLit"><lhs>SimpleLit</lhs>
<rhs>('"' [^"]* '"')</rhs>
<rhs>|&nbsp;("'" [^']* "'")</rhs>
<com>cf. SkipLit</com>
</prod>
<prod id='NT-Markup'><lhs>Markup</lhs>
<rhs>'&lt;' <nt def='NT-Name'>Name</nt>
(<nt def='NT-S'>S</nt>
<nt def='NT-Name'>Name</nt>
<nt def='NT-S'>S</nt>? '=' <nt def='NT-S'>S</nt>?
<nt def='NT-SimpleLit'>SimpleLit</nt>)*
<nt def='NT-S'>S</nt>? '&gt;'</rhs><com>start-tags </com>
<rhs>| '&lt;' <nt def='NT-Name'>Name</nt>
(<nt def='NT-S'>S</nt>
<nt def='NT-Name'>Name</nt>
<nt def='NT-S'>S</nt>? '=' <nt def='NT-S'>S</nt>?
<nt def='NT-SimpleLit'>SimpleLit</nt>)*
<nt def='NT-S'>S</nt>? '/&gt;'</rhs><com>empty elements</com>
<rhs>| '&lt;/'
<nt def='NT-Name'>Name</nt>
<nt def='NT-S'>S</nt>? '&gt;'</rhs>
<com>end-tags </com>
<rhs>| '&amp;' <nt def='NT-Name'>Name</nt> ';'</rhs>
<com>entity references </com>
<rhs>| '&amp;#' [0-9]+ ';'</rhs>
<com>decimal character references </com>
<rhs>| '&hcro;' [0-9a-fA-F]+ ';'</rhs>
<com>hexadecimal character references </com>
<rhs>| '&lt;!&como;'
(<nt def='NT-Char'>Char</nt>* -
(<nt def='NT-Char'>Char</nt>* '&comc;' <nt def='NT-Char'>Char</nt>*))
'&comc;&gt;'</rhs>
<com>comments </com>
<rhs>| '&lt;?'
(<nt def='NT-Char'>Char</nt>* -
(<nt def='NT-Char'>Char</nt>* &pic; <nt def='NT-Char'>Char</nt>*))
'&pic;'</rhs>
<com>processing instructions </com>
<rhs>| '&lt;![CDATA['
(<nt def='NT-Char'>Char</nt>* -
(<nt def='NT-Char'>Char</nt>* ']]&gt;' <nt def='NT-Char'>Char</nt>*))
']]&gt;'</rhs>
<com>CDATA sections</com>
<rhs>| '&lt;!DOCTYPE'
(<nt def="NT-Char">Char</nt> - ('[' | ']'))+
('['
<nt def="NT-simpleDTD">simpleDTD</nt>*
']')? '&gt;'</rhs>
<com>doc type declaration</com>
</prod>
<prod id="NT-simpleDTD"><lhs>simpleDTD</lhs>
<rhs>'&lt;!&como;'
(<nt def='NT-Char'>Char</nt>* -
(<nt def='NT-Char'>Char</nt>* '&comc;' <nt def='NT-Char'>Char</nt>*))
'&comc;&gt;'</rhs>
<com>comment </com>
<rhs>| '&lt;?'
(<nt def='NT-Char'>Char</nt>* -
(<nt def='NT-Char'>Char</nt>* &pic; <nt def='NT-Char'>Char</nt>*))
'&pic;'</rhs>
<com>processing instruction </com>
<rhs><nt def="NT-SimpleLit">SimpleLit</nt></rhs>
<rhs>(<nt def="NT-Char">Char</nt> - (']' | '&lt;' | '"' | "'"))+
</rhs>
<rhs>'&lt;!' (<nt def="NT-Char">Char</nt> - ('-'))+</rhs>
<com>declarations other than comment</com>
</prod>
</prodgroup>
</scrap>
Most processors will require the more complex
grammar given in the body of this specification.
</p>
</div1>
-->
<inform-div1 id="sec-xml-wg">
<head>&informative;W3C XML ワーキンググループ</head>
<p>この&TR-or-Rec;は,W3C XML ワーキンググループ(WG)が準備し,公開を承認した。WGがこの&TR-or-Rec;を承認するということは,WGのすべての委員が承認投票を行ったということを必ずしも意味しない。XML WGの現在の委員及び以前の委員を次に示す。</p>
<!-- parens and spaces removed from role elements by bosak 1997.11.07 -->
<orglist>
<member><name>Jon Bosak, Sun</name><role>Chair</role></member>
<member><name>James Clark</name><role>Technical Lead</role></member>
<member><name>Tim Bray, Textuality and Netscape</name><role>XML Co-editor</role></member>
<member><name>Jean Paoli, Microsoft</name><role>XML Co-editor</role></member>
<member><name>C. M. Sperberg-McQueen, U. of Ill.</name><role>XML Co-editor</role></member>
<member><name>Dan Connolly, W3C</name></member>
<member><name>Steve DeRose, INSO</name></member>
<member><name>Dave Hollander, HP</name></member>
<member><name>Eliot Kimber, Highland</name></member>
<member><name>Eve Maler, ArborText</name></member>
<member><name>Tom Magliery, NCSA</name></member>
<member><name>Murray Maloney, Muzmo and Grif</name></member>
<member><name>村田 真,富士ゼロックス情報システム(株)</name></member>
<member><name>Joel Nava, Adobe</name></member>
<member><name>Peter Sharpe, SoftQuad</name></member>
<member><name>John Tigue, DataChannel</name></member>
</orglist>
</inform-div1>
</back>
</spec>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
End:
-->