<html xmlns="http://www.w3.org/1999/xhtml" a0:Name="SuikaWiki" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:Version="0.9"><head></head><body><p><a0:anchor-end a0:anchor="1">[1]</a0:anchor-end> <a0:anchor>XML</a0:anchor> の<a0:anchor>属性</a0:anchor>の<a0:anchor>型</a0:anchor>
<a0:anchor-external a0:resParameter="http://www.w3.org/TR/REC-xml#sec-attribute-types" a0:resScheme="URI">http://www.w3.org/TR/REC-xml#sec-attribute-types</a0:anchor-external>
について。</p><table><tbody><tr><td>文字列型</td><td><code class="XML"><a0:anchor>CDATA</a0:anchor></code></td></tr><tr><td>字句型</td><td><code class="XML"><a0:anchor>ID</a0:anchor></code></td></tr><tr><td>字句型</td><td><code class="XML"><a0:anchor>IDREF</a0:anchor></code></td></tr><tr><td>字句型</td><td><code class="XML"><a0:anchor>IDREFS</a0:anchor></code></td></tr><tr><td>字句型</td><td><code class="XML"><a0:anchor>ENTITY</a0:anchor></code></td></tr><tr><td>字句型</td><td><code class="XML"><a0:anchor>ENTITIES</a0:anchor></code></td></tr><tr><td>字句型</td><td><code class="XML"><a0:anchor>NMTOKEN</a0:anchor></code></td></tr><tr><td>字句型</td><td><code class="XML"><a0:anchor>NMTOKENS</a0:anchor></code></td></tr><tr><td>列挙型</td><td><code class="XML"><a0:anchor>NOTATION</a0:anchor></code> <var><a0:anchor>群</a0:anchor></var></td></tr><tr><td>列挙型</td><td><var>群</var></td></tr></tbody></table><ul><li><a0:anchor-end a0:anchor="2">[2]</a0:anchor-end> 型が <code class="XML">ID</code>, <code class="XML">NOTATION</code> の属性は、要素型にそれぞれ1つしか存在できません。</li><li><a0:anchor-end a0:anchor="3">[3]</a0:anchor-end> <a0:anchor>互換性のため</a0:anchor>、 <code class="XML">NOTATION</code> 型の属性は<a0:anchor>内容モデル</a0:anchor>が <code class="XML"><a0:anchor>EMPTY</a0:anchor></code> の要素型 (<a0:anchor>強制空要素</a0:anchor>) には存在できません。</li><li><a0:anchor-end a0:anchor="4">[4]</a0:anchor-end> <var>群</var>の<a0:anchor>接続子</a0:anchor>は XML では <code class="XML">|</code> のみです。</li><li><a0:anchor-end a0:anchor="5">[5]</a0:anchor-end> <var>群</var>の構成要素は、記法型の場合は宣言されている <a0:weak>(多分、 DTD のどっかで宣言されていれば属性並び宣言の後でもいい。)</a0:weak> <a0:anchor>名前</a0:anchor>で、単なる列挙型の場合は<a0:anchor>名前字句</a0:anchor> (<code class="XML">Nmtoken</code>) です。</li><li><a0:anchor-end a0:anchor="6">[6]</a0:anchor-end> <a0:anchor>相互運用性のため</a0:anchor>、単なる列挙型の候補の名前字句はその要素型の単なる列挙型全ての中で一意であるべきです。</li><li><a0:anchor-end a0:anchor="7">[7]</a0:anchor-end> <var>群</var>それぞれの構成要素に重複がある (<samp class="XML">(あ|い|あ)</samp>) のとか、群と<a0:anchor>引数実体</a0:anchor>が適当に入れ子になっていない (<samp class="XML">(あ|%t;</samp>) のは駄目な気がするんですが、仕様書にはなんとも書かれていません。</li><li><a0:anchor-end a0:anchor="8">[8]</a0:anchor-end> 属性の型は<a0:anchor>属性並び宣言</a0:anchor>で宣言します。属性が宣言されていない場合や属性並び宣言を含む部分が読まれていない場合には <code class="XML">CDATA</code> とみなされます。</li></ul><p><a0:anchor-end a0:anchor="10">[10]</a0:anchor-end>
<a0:anchor-internal a0:anchor="7">&gt;&gt;7</a0:anchor-internal> 前者は妥当性制約 <q>No Duplicate Tokens</q> で禁じられていました。
(<a0:anchor>Mr.Anonymous</a0:anchor> <a0:weak>2004-05-27 12:20:28 +00:00</a0:weak>)</p><p><a0:anchor-end a0:anchor="11">[11]</a0:anchor-end>
<a0:anchor-internal a0:anchor="7">&gt;&gt;7</a0:anchor-internal> 後者は妥当性制約 <q>Proper Group/PE Nesting</q> が該当しそうだけどよく読むと<a0:anchor>模型群</a0:anchor>にしか適用されないし。</p><comment-p xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:10:">もっとも、 <a0:anchor>SGML</a0:anchor> 的には<a0:anchor>列挙型</a0:anchor>の指定も<a0:anchor>群</a0:anchor>なので、
同じような妥当性制約が必要なはず。
(<a0:anchor>Mr.Anonymous</a0:anchor> <a0:weak>2004-05-27 12:24:24 +00:00</a0:weak>)</comment-p><a0:form ref="comment"></a0:form><section><h1>場面ごとの属性の型の使用可否</h1><p><a0:anchor-end a0:anchor="9">[9]</a0:anchor-end><table><tbody><tr><td>型名</td><td colspan="2">要素属性</td><td>データ属性</td><td>連結属性</td></tr><tr><td></td><td>XML</td><td colspan="3">SGML</td></tr><tr><td><code class="SGML"><a0:anchor>CDATA</a0:anchor></code></td><td>○</td><td>○</td><td>○</td><td>○</td></tr><tr><td><code class="SGML"><a0:anchor>ENTITIES</a0:anchor></code></td><td>○</td><td>○</td><td>×</td><td>○</td></tr><tr><td><code class="SGML"><a0:anchor>ENTITY</a0:anchor></code></td><td>○</td><td>○</td><td>×</td><td>○</td></tr><tr><td><code class="SGML"><a0:anchor>ID</a0:anchor></code></td><td>○</td><td>○</td><td>×</td><td>×</td></tr><tr><td><code class="SGML"><a0:anchor>IDREF</a0:anchor></code></td><td>○</td><td>○</td><td>×</td><td>×</td></tr><tr><td><code class="SGML"><a0:anchor>IDREFS</a0:anchor></code></td><td>○</td><td>○</td><td>×</td><td>×</td></tr><tr><td><code class="SGML"><a0:anchor>NAME</a0:anchor></code></td><td>×</td><td>○</td><td>○</td><td>○</td></tr><tr><td><code class="SGML"><a0:anchor>NAMES</a0:anchor></code></td><td>×</td><td>○</td><td>○</td><td>○</td></tr><tr><td><code class="SGML"><a0:anchor>NMTOKEN</a0:anchor></code></td><td>○</td><td>○</td><td>○</td><td>○</td></tr><tr><td><code class="SGML"><a0:anchor>NMTOKENS</a0:anchor></code></td><td>○</td><td>○</td><td>○</td><td>○</td></tr><tr><td><code class="SGML"><a0:anchor>NOTATION</a0:anchor></code></td><td>△</td><td>△</td><td>×</td><td>×</td></tr><tr><td><code class="SGML"><a0:anchor>NUMBER</a0:anchor></code></td><td>×</td><td>○</td><td>○</td><td>○</td></tr><tr><td><code class="SGML"><a0:anchor>NUMBERS</a0:anchor></code></td><td>×</td><td>○</td><td>○</td><td>○</td></tr><tr><td><code class="SGML"><a0:anchor>NUTOKEN</a0:anchor></code></td><td>×</td><td>○</td><td>○</td><td>○</td></tr><tr><td><code class="SGML"><a0:anchor>NUTOKENS</a0:anchor></code></td><td>×</td><td>○</td><td>○</td><td>○</td></tr><tr><td>列挙</td><td>○</td><td>○</td><td>○</td><td>○</td></tr><tr><td>データ指定</td><td>×</td><td>○</td><td>○</td><td>○</td></tr></tbody></table></p><p>参照 :<ul><li>属性定義 10.3</li><li>データ属性 10.4.1</li><li>連結属性 11.1.4.2</li><li><a0:anchor>データ指定</a0:anchor> K.4.4.3</li></ul></p><a0:form ref="comment"></a0:form></section><section><h1>メモ</h1></section></body></html>