1. 動機と要約
~XML( Extensible Markup Language )の応用として、単独の~XML文書が複数の “~markup語彙” を包含していて、そのそれぞれを成す[ 要素, 属性 ]群は,それぞれに異なる~software~module[ 用に定義される/から利用される ]ことが想定される。 これを想定する動機の一つは、その~module性にある。 そのような~markup語彙が存在し, きちんと理解されていて, そのための有用な~softwareが可用であるならば、新たな~markupを再~発明するよりも,その~markupを再~利用する方がよい。 ◎ We envision applications of Extensible Markup Language (XML) where a single XML document may contain elements and attributes (here referred to as a "markup vocabulary") that are defined for and used by multiple software modules. One motivation for this is modularity: if such a markup vocabulary exists which is well-understood and for which there is useful software available, it is better to re-use this markup rather than re-invent it.
文書が複数の~markup語彙を包含しているような場合、語彙の認識と衝突が問題になる。 ~software~moduleは,その処理対象として設計された要素や属性を、それらの名前が,何らかの他の~software~package用の~markupに用いられている要素や属性の名前との “衝突” に面したときでも、認識できる必要がある。 ◎ Such documents, containing multiple markup vocabularies, pose problems of recognition and collision. Software modules need to be able to recognize the elements and attributes which they are designed to process, even in the face of "collisions" occurring when markup intended for some other software package uses the same element name or attribute name.
これらを考慮するとき、文書の構成子に付与される名前は,異なる~markup語彙に属する名前 間の衝突-を避けるように構築することが求められる。 この仕様は、 ~XML~ns と呼ばれる仕組みを述べる — それは、要素や属性に`展開~名$をあてがうことにより,これを達成する。 ◎ These considerations require that document constructs should have names constructed so as to avoid clashes between names from different markup vocabularies. This specification describes a mechanism, XML namespaces, which accomplishes this by assigning expanded names to elements and attributes.
1.1. 表記と用法についての注意
【この節の他の内容( [RFC2119] 関連)は省略する。】 ◎ Where EMPHASIZED, the key words MUST, MUST NOT, REQUIRED, SHOULD, SHOULD NOT, MAY in this document are to be interpreted as described in [Keywords].
この仕様~内の生成規則~内の非終端記号の多くは、ここではなく,~XML仕様 `XML$r にて定義されることに注意。 ここに定義される非終端記号が ~XML仕様の非終端記号と同じ名前を持つ場合、すべての事例において,前者に合致する文字列の集合は 後者に合致する文字列の集合の部分集合になる。 ◎ Note that many of the nonterminals in the productions in this specification are defined not here but in the XML specification [XML]. When nonterminals defined here have the same names as nonterminals defined in the XML specification, the productions here in all cases match a subset of the strings matched by the corresponding ones there.
この仕様に適合する文書は、この文書の各 生成規則に付与される“~ns拘束” ( Namespace Constraint )に従わ~MUST。 ◎ In this document's productions, the NSC is a "Namespace Constraint", one of the rules that documents conforming to this specification MUST follow.
2. ~XML~ns
2.1. 基本~概念
定義: `~XML~ns@ は、 ~IURI 参照 `RFC3986$r`RFC3987$r により識別される。 要素~名/属性~名は、この仕様に述べる仕組みを用いることにより,何らかの`~XML~ns$に属し得る。 [Definition: An XML namespace is identified by a URI reference [RFC3986] an IRI reference [RFC3987] ; element and attribute names may be placed in an XML namespace using the mechanisms described in this specification. ]
定義: `展開~名@ とは、 ( `~ns名$,`局所~名$ ) の組である。 ◎ [Definition: An expanded name is a pair consisting of a namespace name and a local name. ]\
定義: 所与の名前 `名前^V 用の `~ns名@ は、 `名前^V が ~IURI `S^V として識別される~nsに属するならば、 `S^V である。 名前 `名前^V がどの~nsにも属さないならば、その~ns名の値はない。 ◎ [Definition: For a name N in a namespace identified by a ~IURI I, the namespace name is I. For a name N that is not in a namespace, the namespace name has no value. ]\
定義: いずれの事例でも、 `局所~名@ は, `名前^V になる。 ◎ [Definition: In either case the local name is N. ]\
[ 統一的に管理される ~IURI としての~ns, 語彙の`局所~名$ ]の組合わせにより、名前の衝突-は避けられるようになる。 ◎ It is this combination of the universally managed ~IURI namespace with the vocabulary's local names that is effective in avoiding name clashes.
~IURI 参照は名前に許容されない文字を包含し得る上,長くて不便なので、`展開~名$が~XML文書の要素や属性の名前に直に利用されることはない。 代わりに`有修飾~名$が用いられる。 ◎ ~IURI references can contain characters not allowed in names, and are often inconveniently long, so expanded names are not used directly to name elements and attributes in XML documents. Instead qualified names are used.\
定義: `有修飾~名@ とは、~nsの解釈の対象になる名前である。 ◎ [Definition: A qualified name is a name subject to namespace interpretation. ]\
この仕様に適合する文書においては、要素~名/属性~名は`有修飾~名$として出現する。 構文としては、それらは 接頭辞ありの名前( `PrefixedName$P ) または、接頭辞なしの名前( `UnprefixedName$P ) のいずれかであり、接頭辞を~ns名に束縛するための, および 接頭辞なしの要素~名を既定の~nsに束縛するための,属性に基づく宣言~構文が供されている。 これらの宣言の視野(有効範囲)は、文書の他の部分には異なる束縛を適用し得るようにするため,それが出現する要素~下(要素~自身とその内容)に限られる。 この仕様に適合する処理器は、これらの宣言や接頭辞を認識して 動作し~MUST。 ◎ In documents conforming to this specification, element and attribute names appear as qualified names. Syntactically, they are either prefixed names or unprefixed names. An attribute-based declaration syntax is provided to bind prefixes to namespace names and to bind a default namespace that applies to unprefixed element names; these declarations are scoped by the elements on which they appear so that different bindings may apply in different parts of a document. Processors conforming to this specification MUST recognize and act on these declarations and prefixes.
2.2. ~ns名としての ~IURI の利用
空~文字列は、 ~IURI 参照としては合法であっても,~ns名として用いることはできない。 ◎ The empty string, though it is a legal URI reference, cannot be used as a namespace name.
~ns宣言における相対 ~IURI 参照の利用は、同じ文書への参照も含め,非推奨にされた。 ◎ The use of relative ~IURI references, including same-document references, in namespace declarations is deprecated.
注記:
このことは、 W3C XML Plenary Ballot
`Relative-URI-deprecation$r
により決められた。
そこでは、
DOM, XPath などの後の仕様においても、それらに対する解釈は定義しないとする
ことも宣言された。
◎
Note: This deprecation of relative URI references was decided on by a W3C XML Plenary Ballot [Relative URI deprecation].
It also declares that "later specifications such as DOM, XPath, etc. will define no interpretation for them".
2.3. ~IURI 参照の比較-法
~nsを識別する ~IURI 参照は、ある名前が与えられた~nsに属するかどうか, および 2 つの名前が同じ~nsに属するかどうかを決定する際に比較される。 ◎ ~IURI references identifying namespaces are compared when determining whether a name belongs to a given namespace, and whether two names belong to the same namespace.\
定義: 2 つの ~IURI は文字列として扱うものとし、文字列として一致するとき,すなわち同じ文字~並びであるとき, そのときに限り `互いに一致@ するとする。 ◎ [Definition: The two ~IURI s are treated as strings, and they are identical if and only if the strings are identical, that is, if they are the same sequence of characters. ]\
比較においては、文字大小は区別され,~percent-escapeしたりその逆に戻すことはない。 ◎ The comparison is case-sensitive, and no %-escaping is done or undone.
したがって,2 つの ~IURI 参照は、`互いに一致$しなくても,同じ資源に解決され得る。 例えば、文字大小や~percent-escapeの有無においてのみ異なる, ~IURI 参照、あるいは[ 基底~URIが異なる外部~実体 ]内の ~IURI 参照(が、相対 ~IURI 参照は,~ns名として非推奨にされたことに注意)。 ◎ A consequence of this is that URI references which are not identical in this sense may resolve to the same resource. Examples include URI references which differ only in case or %-escaping, or which are in external entities which have different base URIs (but note that relative URIs are deprecated as namespace names).
~ns宣言における ~IURI 参照は,属性の`正規化された値$であり、~XML文字や実体~参照の置換は どの比較よりも先に行われる。 ◎ In a namespace declaration, the ~IURI reference is the normalized value of the attribute, so replacement of XML character and entity references has already been done before any comparison.
例
次の ~IURI 参照は,互いの文字大小が異なるので、~nsを識別する目的においては,すべて互いに異なる: ◎ The ~IURI references below are all different for the purposes of identifying namespaces, since they differ in case:
- `http://www.example.org/wine^l
- `http://www.Example.org/wine^l
- `http://www.example.org/Wine^l
次の ~IURI 参照も、~nsを識別する目的においては,すべて互いに異なる: ◎ The ~IURI references below are also all different for the purposes of identifying namespaces:
- `http://www.example.org/rosé^l
- `http://www.example.org/ros%c3%a9^l
- `http://www.example.org/ros%c3%A9^l
- `http://www.example.org/ros%C3%a9^l
- `http://www.example.org/ros%C3%A9^l
次も同様である: ◎ As are these:
- `http://www.example.org/~wilbur^l
- `http://www.example.org/%7ewilbur^l
- `http://www.example.org/%7Ewilbur^l
実体 `eacute^l が `é^l として定義されているならば,次の開始tagはすべて、接頭辞 `p^l を同じ ~IURI 参照 `http://example.org/rosé^l に束縛する~ns宣言を包含する。 ◎ If the entity eacute has been defined to be é, the start tags below all contain namespace declarations binding the prefix p to the same IRI reference, http://example.org/rosé.
- `<p:foo xmlns:p="http://example.org/rosé">^l
- `<p:foo xmlns:p="http://example.org/rosé">^l
- `<p:foo xmlns:p="http://example.org/rosé">^l
- `<p:foo xmlns:p="http://example.org/rosé">^l
- `<p:foo xmlns:p="http://example.org/rosé">^l
参照の解決後に等価になる ~IURI による混同~riskがあるので、~ns名においては,~percent-escape化された文字は利用しないことが強く奨励される。 ◎ Because of the risk of confusion between ~IURI s; that would be equivalent if dereferenced, the use of %-escaped characters in namespace names is strongly discouraged.
3. ~nsの宣言
定義: ~nsは(より精確には,~ns束縛は)、予約-済み属性の族を用いて `宣言-@ される。 そのような属性~名は `xmlns^l か, または `xmlns:^l から始まるものでなければならない。 これらの属性は、他の~XML属性と同様に,直にあるいは 既定 により与え得る。 ◎ [Definition: A namespace (or more precisely, a namespace binding) is declared using a family of reserved attributes. Such an attribute's name must either be xmlns or begin xmlns:. These attributes, like any other XML attributes, may be provided directly or by default. ]
- [1] `NSAttName@P
- `PrefixedAttName$P | `DefaultAttName$P
- [2] `PrefixedAttName@P
- 'xmlns:' `NCName$P
- ~ns拘束:`予約-済み接頭辞と~ns名$NSC ◎ [NSC: Reserved Prefixes and Namespace Names]
- [3] `DefaultAttName@P
- 'xmlns'
- [4] `NCName@P
- `Name$P - (`Char$P* ':' `Char$P*)
- `NCNameStartChar$P `NCNameChar$P*
- ( `:^l を含まない~XML `~Name10$P `~Name11$P ) ◎ /* An XML Name, minus the ":" */
- [5] `NCNameChar@P
- `NameChar$P - ':'
- 【 1.0 過去版の [5][6] は F 節に移動 】
- [6] `NCNameStartChar@P
- `NameStartChar$P - ':'
属性の`正規化された値$は、~nsを識別する`~ns名$としての ~IURI 参照であるか, または 空~文字列で~MUST。 ~ns名は、それが意図する目的に鑑みて,一意的かつ永続的になる~SHOULDである。 存在する~schemaの検索取得に直に利用できることは目標ではない。 そのような目標を念頭に設計された例としては、 Uniform Resource Names `RFC2141$r がある。 しかしながら,普通の URL は、そのような仕方で管理して,同じ目標を得れることは注記しておく。 ◎ The attribute's normalized value MUST be either a ~IURI reference — the namespace name identifying the namespace — or an empty string. The namespace name, to serve its intended purpose, SHOULD have the characteristics of uniqueness and persistence. It is not a goal that it be directly usable for retrieval of a schema (if any exists). Uniform Resource Names [RFC2141] is an example of a syntax that is designed with these goals in mind. However, it should be noted that ordinary URLs can be managed in such a way as to achieve these same goals.
定義: 属性~名が `PrefixedAttName$P に合致するならば、その `NCName$P が `~ns接頭辞@ を与え,その属性~値の`~ns名$がその宣言が付与された要素の視野において,~ns名と要素~名/属性~名との結付けに利用される。 ◎ [Definition: If the attribute name matches PrefixedAttName, then the NCName gives the namespace prefix, used to associate element and attribute names with the namespace name in the attribute value in the scope of the element to which the declaration is attached. ]
定義: 属性~名が `DefaultAttName$P に合致するならば、その属性~値の`~ns名$がその宣言が付与された要素の視野において, `既定の~ns@ になる。 ◎ [Definition: If the attribute name matches DefaultAttName, then the namespace name in the attribute value is that of the default namespace in the scope of the element to which the declaration is attached.]\
既定の~ns, および宣言の上書き法については、 要素/属性に対する~nsの適用-法 節に論じられる。 ◎ Default namespaces and overriding of declarations are discussed in 6 Applying Namespaces to Elements and Attributes.
次の例は、~ns接頭辞 `edi^l を~ns名 `http://ecommerce.example.org/schema^l に結付ける~ns宣言である: ◎ An example namespace declaration, which associates the namespace prefix edi with the namespace name http://ecommerce.example.org/schema:
<x xmlns:edi='http://ecommerce.example.org/schema'>
<!--
接頭辞 `edi^l は `x^l 要素とその内容において
`http://ecommerce.example.org/schema^l に束縛される
◎
the "edi" prefix is bound to http://ecommerce.example.org/schema for the "x" element and contents
-->
</x>
- ~ns拘束: `予約-済み接頭辞と~ns名@NSC ◎ Namespace constraint: Reserved Prefixes and Namespace Names
-
接頭辞 `xml^c は、定義により,~ns名 `http://www.w3.org/XML/1998/namespace^l に束縛される。 この~nsは: ◎ The prefix xml is by definition bound to the namespace name http://www.w3.org/XML/1998/namespace.\
- 宣言されても~MAYが,する必要はない。 ◎ It MAY, but need not, be declared, and MUST NOT be\
- 未宣言にされては~MUST_NOT ◎ undeclared or\
- 他のいかなる~ns名にも束縛されては~MUST_NOT。 ◎ bound to any other namespace name.\
- 他の接頭辞がこの~ns名に束縛されては~MUST_NOT。 ◎ Other prefixes MUST NOT be bound to this namespace name, and\
- 既定の~nsとして宣言されては~MUST_NOT。 ◎ it MUST NOT be declared as the default namespace.
-
接頭辞 `xmlns^c は,~ns束縛の宣言のみに用いられ、定義により,~ns名 `http://www.w3.org/2000/xmlns/^l に束縛される。 この~nsは: ◎ The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name http://www.w3.org/2000/xmlns/.
- 宣言されては~MUST_NOT。 ◎ It MUST NOT be declared\
- 未宣言にされては~MUST_NOT。 ◎ or undeclared\
- 他の接頭辞がこの~nsに束縛されては~MUST_NOT。 ◎ . Other prefixes MUST NOT be bound to this namespace name, and\
- 既定の~nsとして宣言されては~MUST_NOT。 ◎ it MUST NOT be declared as the default namespace.\
- 要素~名は、接頭辞 `xmlns^l を持っては~MUST_NOT。 ◎ Element names MUST NOT have the prefix xmlns.
-
文字大小を区別しない下で頭部が `xml^l に一致するような,他のすべての接頭辞も予約-済みである。 したがって: ◎ All other prefixes beginning with the three-letter sequence x, m, l, in any case combination, are reserved. This means that:
- 利用者は、後の仕様において定義される場合を除き,それらを用いる~SHOULDではない。 ◎ users SHOULD NOT use them except as defined by later specifications
- 処理器は、それらを致命的~errorとみなしては~MUST_NOT。 ◎ processors MUST NOT treat them as fatal errors.
接頭辞が予約-済みでないとしても、文字大小を区別しない下で `LocalPart$P の頭部が `xml^l に一致するような名前の利用は、接頭辞なしで用いられたときに予約-済みになってしまうので勧められない。 ◎ Though they are not themselves reserved, it is inadvisable to use prefixed names whose LocalPart begins with the letters x, m, l, in any case combination, as these names would be reserved if used without a prefix.
4. 有修飾~名
この仕様に適合する~XML文書においては、一部の名前(非終端記号 `~Name10$P `~Name11$P に対応する構成子)は,次で定義される`有修飾~名$として与えられ~MUST: ◎ In XML documents conforming to this specification, some names (constructs corresponding to the nonterminal Name) MUST be given as qualified names, defined as follows: ◎ Qualified Name
- [7] `QName@P
- `PrefixedName$P | `UnprefixedName$P
- [8] `PrefixedName@P
- `Prefix$P ':' `LocalPart$P
- [9] `UnprefixedName@P
- `LocalPart$P
- [10] `Prefix@P
- `NCName$P
- [11] `LocalPart@P
- `NCName$P
接頭辞( `Prefix$P )は,`有修飾~名$の`~ns接頭辞$ 部を与え、`~ns宣言$の中の~ns ~IURI 参照に結付けられ~MUST。 ◎ The Prefix provides the namespace prefix part of the qualified name, and MUST be associated with a namespace ~IURI reference in a namespace declaration.\
定義: `LocalPart$P は、`有修飾~名$の `局所~部位@ を与える。 ◎ [Definition: The LocalPart provides the local part of the qualified name.]
接頭辞は~ns名の~placeholderとしてのみ機能することに注意。 ~appは、視野が 包含している文書を超えるような名前を構築するときは、接頭辞ではなく,~ns名を利用する~SHOULDである。 ◎ Note that the prefix functions only as a placeholder for a namespace name. Applications SHOULD use the namespace name, not the prefix, in constructing names whose scope extends beyond the containing document.
5. 有修飾~名の利用
この仕様に適合する~XML文書においては、要素の名前は,次のように,`有修飾~名$として与えられる: ◎ In XML documents conforming to this specification, element names are given as qualified names, as follows: ◎ Element Names
- [12] `STag@P
- '<' `QName$P (`S$P `~Attribute10$P`~Attribute11$P)* `S$P? '>'
- ~ns拘束:`接頭辞は宣言-済み$NSC ◎ [NSC: Prefix Declared]
- [13] `ETag@P
- '</' `QName$P `S$P? '>'
- ~ns拘束:`接頭辞は宣言-済み$NSC ◎ [NSC: Prefix Declared]
- [14] `EmptyElemTag@P
- '<' `QName$P (`S$P `~Attribute10$P`~Attribute11$P)* `S$P? '/>'
- ~ns拘束:`接頭辞は宣言-済み$NSC ◎ [NSC: Prefix Declared]
要素~名として機能する`有修飾~名$の例: ◎ An example of a qualified name serving as an element name:
<!--
`price^e 要素が属する~nsは `http://ecommerce.example.org/schema^l になる。
◎
the 'price' element's namespace is http://ecommerce.example.org/schema
-->
<edi:price xmlns:edi='http://ecommerce.example.org/schema'
units='Euro'>32.18</edi:price>
属性は`~ns宣言$になるか,または`有修飾~名$として名前が与えられる: ◎ Attributes are either namespace declarations or their names are given as qualified names: ◎ Attribute
- [15] `Attribute@P
- `NSAttName$P `Eq$P `AttValue$P | `QName$P `Eq$P `AttValue$P
- ~ns拘束: `接頭辞は宣言-済み$NSC ◎ [NSC: Prefix Declared]
- ~ns拘束: `接頭辞を未宣言にするものはない$NSC ◎ [NSC: No Prefix Undeclaring]
- ~ns拘束: `属性は一意的である$NSC ◎ [NSC: Attributes Unique]
属性~名として機能する`有修飾~名$の例: ◎ An example of a qualified name serving as an attribute name:
<x xmlns:edi='http://ecommerce.example.org/schema'>
<!--
`taxClass^c 属性が属する~nsは
`http://ecommerce.example.org/schema^l になる
◎
the 'taxClass' attribute's namespace is http://ecommerce.example.org/schema
-->
<lineItem edi:taxClass="exempt">Baby food</lineItem>
</x>
- ~ns拘束: `接頭辞は宣言-済み@NSC ◎ Namespace constraint: Prefix Declared
- `xml^l または `xmlns^l 以外の~ns接頭辞は、 その接頭辞が用いられている要素の開始tagか,またはその先祖~要素(すなわち,接頭辞による~markupがその`内容$に出現している要素)において、`~ns宣言$属性により宣言されてい~MUST。 ◎ The namespace prefix, unless it is xml or xmlns, MUST have been declared in a namespace declaration attribute in either the start-tag of the element where the prefix is used or in an ancestor element (i.e., an element in whose content the prefixed markup occurs).\
- 更に、そのような宣言のうち最も内側にあるものの属性~値は,空~文字列であっては~MUST_NOT。 ◎ Furthermore, the attribute value in the innermost such declaration MUST NOT be an empty string
- ~ns拘束: `接頭辞を未宣言にするものはない@NSC ◎ Namespace constraint: No Prefix Undeclaring
- 接頭辞( `Prefix$P )を宣言する`~ns宣言$においては(すなわち, `NSAttName$P が `PrefixedAttName$P になっている所では)、属性~値( `AttValue$P )は空であっては~MUST_NOT。 ◎ In a namespace declaration for a prefix (i.e., where the NSAttName is a PrefixedAttName), the attribute value MUST NOT be empty.
この拘束により: ~ns宣言~属性が~XML`文書~実体$内に直にではなく,外部~実体で宣言された既定の属性を介して与えられている所では、演算~上の困難がもたらされ得る。 そのような宣言は、検証しない~XML処理器に基づく~softwareからは読取られないこともある。 多くの~XML~appは、おそらく~nsを取り扱えるものも含め,検証-用の処理器を要求していない。 そのような~appにおいて正しい演算が要求される場合、~ns宣言は,直に与えられるか, または内部~subsetの`~DTD$内で宣言される既定の属性を介して与えられ~MUST。 ◎ This constraint may lead to operational difficulties in the case where the namespace declaration attribute is provided, not directly in the XML document entity, but via a default attribute declared in an external entity. Such declarations may not be read by software which is based on a non-validating XML processor. Many XML applications, presumably including namespace-sensitive ones, fail to require validating processors. If correct operation with such applications is required, namespace declarations MUST be provided either directly or via default attributes declared in the internal subset of the DTD.
要素~名や属性~名は、`~DTD$の中の宣言に出現するときには,`有修飾~名$としても与えられる: ◎ Element names and attribute names are also given as qualified names when they appear in declarations in the DTD: ◎ Qualified Names in Declarations
- [16] `doctypedecl@P
- '<!DOCTYPE' `S$P `QName$P (`S$P `ExternalID$P)? `S$P? ('[' (`markupdecl$P | `PEReference$P | `S$P)* ']' `S$P?)? '>'
- [17] `elementdecl@P
- '<!ELEMENT' `S$P `QName$P `S$P `contentspec$P `S$P? '>'
- [18] `cp@P
- (`QName$P | `choice$P | `seq$P) ('?' | '*' | '+')?
- [19] `Mixed@P
- '(' `S$P? '#PCDATA' (`S$P? '|' `S$P? `QName$P)* `S$P? ')*' | '(' `S$P? '#PCDATA' `S$P? ')'
- [20] `AttlistDecl@P
- '<!ATTLIST' `S$P `QName$P `AttDef$P* `S$P? '>'
- [21] `AttDef@P
- `S$P (`QName$P | `NSAttName$P) `S$P `AttType$P `S$P `DefaultDecl$P
~DTDに基づく検証は、次の~~意味で~nsを認識しないものであることに注意: ~DTDは,文書~内に出現してもよい要素や属性を、 ( ~ns名, `局所~名$ ) の組としてではなく,それらの名前を解釈することなく拘束する。 ~nsを利用する文書を~DTDに突き合わせて検証する際には、各~instanceに用いられている接頭辞と同じ接頭辞が~DTDの中で用いられていなければならない。 しかしながら,~DTDは、~nsを宣言する属性に対し `#FIXED^l 値を供することにより,妥当な文書に利用される~nsを間接的に拘束し得る。 ◎ Note that DTD-based validation is not namespace-aware in the following sense: a DTD constrains the elements and attributes that may appear in a document by their uninterpreted names, not by (namespace name, local name) pairs. To validate a document that uses namespaces against a DTD, the same prefixes must be used in the DTD as in the instance. A DTD may however indirectly constrain the namespaces used in a valid document by providing #FIXED values for attributes that declare namespaces.
6. 要素/属性に対する~nsの適用-法
6.1. ~nsの視野
接頭辞を宣言する~ns宣言の視野は、それが出現する開始tagから対応する終了tagまでの~~範囲から,より内縁にあり, `NSAttName$P 部が同じになるような すべての[ 接頭辞を宣言する~ns宣言 ]の視野を除外した~~範囲になる。 空~tagの事例における視野は,その~tag自身になる。 ◎ The scope of a namespace declaration declaring a prefix extends from the beginning of the start-tag in which it appears to the end of the corresponding end-tag, excluding the scope of any inner declarations with the same NSAttName part. In the case of an empty tag, the scope is the tag itself.
そのような~ns宣言は、その視野に入り, かつ その宣言で指定された接頭辞に合致する接頭辞を持つような,すべての要素~名/属性~名に適用される。 ◎ Such a namespace declaration applies to all element and attribute names within its scope whose prefix matches that specified in the declaration.
接頭辞ありの要素~名/属性~名に対応する`展開~名$は、その接頭辞( `Prefix$P ) を束縛する ~IURI を`~ns名$に持ち,その`局所~部位$( `LocalPart$P )を`局所~名$に持つ。 ◎ The expanded name corresponding to a prefixed element or attribute name has the ~IURI to which the prefix is bound as its namespace name, and the local part as its local name.
<?xml version="~1011"?> <html:html xmlns:html='http://www.w3.org/1999/xhtml'> <html:head><html:title>Frobnostication</html:title></html:head> <html:body><html:p>Moved to <html:a href='http://frob.example.com'>here.</html:a></html:p></html:body> </html:html>
次の例に示すように、単独の要素において複数の~ns接頭辞を属性として宣言できる: ◎ Multiple namespace prefixes can be declared as attributes of a single element, as shown in this example:
<?xml version="~1011"?>
<!--
`bk^l, `isbn^l 両 ~ns接頭辞とも可用になる
◎
both namespace prefixes are available throughout
-->
<bk:book xmlns:bk='urn:loc.gov:books'
xmlns:isbn='urn:ISBN:0-395-36341-6'>
<bk:title>Cheaper by the Dozen</bk:title>
<isbn:number>1568491379</isbn:number>
</bk:book>
接頭辞を宣言する~ns宣言の属性~値は、空であっても~MAY。 これには、その宣言の視野において,その接頭辞と~ns名との結付けを除去する効果がある。 更なる宣言により,接頭辞を再~宣言しても~MAY: ◎ The attribute value in a namespace declaration for a prefix MAY be empty. This has the effect, within the scope of the declaration, of removing any association of the prefix with a namespace name. Further declarations MAY re-declare the prefix again:
<?xml version="1.1"?> <x xmlns:n1="http://www.w3.org"> <n1:a/> <!-- 合法: 接頭辞 `n1^c は `http://www.w3.org^l に束縛されている ◎ legal; the prefix n1 is bound to http://www.w3.org --> <x xmlns:n1=""> <n1:a/> <!-- 違法: 接頭辞 `n1^c はここでは束縛されていない ◎ illegal; the prefix n1 is not bound here --> <x xmlns:n1="http://www.w3.org"> <n1:a/> <!-- 合法: 接頭辞 `n1^c は再び束縛されている ◎ legal; the prefix n1 is bound again --> </x> </x> </x>
6.2 既定の~nsの適用-法
`既定の~ns$宣言の視野は、より内縁の既定の~ns宣言の視野を除き,それが出現する開始tagから対応する終了tagまでにわたる。 空~tagの事例における視野はその~tag自身になる。 ◎ The scope of a default namespace declaration extends from the beginning of the start-tag in which it appears to the end of the corresponding end-tag, excluding the scope of any inner default namespace declarations. In the case of an empty tag, the scope is the tag itself.
既定の~ns宣言は、その視野に入る,接頭辞なしの要素~名すべてに適用される。 既定の~ns宣言は属性~名には直には適用されない。 接頭辞なしの属性の解釈は、それが出現している要素から決定される。 ◎ A default namespace declaration applies to all unprefixed element names within its scope. Default namespace declarations do not apply directly to attribute names; the interpretation of unprefixed attributes is determined by the element on which they appear.
接頭辞なしの要素が,ある既定の~ns宣言の視野に入る場合、その要素に対応する`展開~名$は、その`既定の~ns$の ~IURI を`~ns名$に持つ。 視野に既定の~ns宣言がなければ,~ns名は値を持たない。 接頭辞なしの属性~名の~ns名は 常に値を持たない。 いずれの事例においても,`局所~名$は`局所~部位$( `LocalPart$P )になる(もちろん,これは接頭辞なしの名前~自身と同じになる)。 ◎ If there is a default namespace declaration in scope, the expanded name corresponding to an unprefixed element name has the ~IURI of the default namespace as its namespace name. If there is no default namespace declaration in scope, the namespace name has no value. The namespace name for an unprefixed attribute name always has no value. In all cases, the local name is local part (which is of course the same as the unprefixed name itself).
<?xml version="~1011"?>
<!--
この事例では、要素は既定において~HTML~nsに属する
◎
elements are in the HTML namespace, in this case by default
-->
<html xmlns='http://www.w3.org/1999/xhtml'>
<head><title>Frobnostication</title></head>
<body><p>Moved to
<a href='http://frob.example.com'>here</a>.</p></body>
</html>
<?xml version="~1011"?>
<!--
接頭辞なしの要素~型は `urn:loc.gov:books^l に属する
◎
unprefixed element types are from "books"
-->
<book xmlns='urn:loc.gov:books'
xmlns:isbn='urn:ISBN:0-395-36341-6'>
<title>Cheaper by the Dozen</title>
<isbn:number>1568491379</isbn:number>
</book>
~nsの視野をあてがうやや大きめな例: ◎ A larger example of namespace scoping:
<?xml version="~1011"?> <!-- 初期~時において,既定の~nsは `urn:loc.gov:books^l ◎ initially, the default namespace is "books" --> <book xmlns='urn:loc.gov:books' xmlns:isbn='urn:ISBN:0-395-36341-6'> <title>Cheaper by the Dozen</title> <isbn:number>1568491379</isbn:number> <notes> <!-- 何かの説明用に~HTMLを既定の~nsにする ◎ make HTML the default namespace for some commentary --> <p xmlns='http://www.w3.org/1999/xhtml'> This is a <i>funny</i> book! </p> </notes> </book>
既定の~ns宣言における属性~値は、空にされても~MAY。 その効果は、[ 宣言の視野の中には既定の~nsは無い ]のと同じになる。 ◎ The attribute value in a default namespace declaration MAY be empty. This has the same effect, within the scope of the declaration, of there being no default namespace.
<?xml version='~1011'?> <Beers> <!-- `table^e の内側における既定の~nsは ~HTML~ns ◎ the default namespace inside tables is that of HTML --> <table xmlns='http://www.w3.org/1999/xhtml'> <th><td>Name</td><td>Origin</td><td>Description</td></th> <tr> <!-- `table^e ~cellの内側には 既定の~nsは無い ◎ no default namespace inside table cells --> <td><brandName xmlns="">Huntsman</brandName></td> <td><origin xmlns="">Bath, UK</origin></td> <td> <details xmlns=""><class>Bitter</class><hop>Fuggles</hop> <pro>Wonderful hop, light alcohol, good summer beer</pro> <con>Fragile; excessive variance pub to pub</con> </details> </td> </tr> </table> </Beers>
6.3 属性の一意性
- ~ns拘束: `属性は一意的である@NSC ◎ Namespace constraint: Attributes Unique
-
この仕様に適合する~XML文書においては、どの~tagも,次を満たすような複数~個の属性を包含してはならない: ◎ In XML documents conforming to this specification, no tag may contain two attributes which:
- 互いの名前は同じ, または ◎ have identical names, or
-
それらの`有修飾~名$は、次を満たす:
- それぞれの`局所~部位$は 互いに同じ, かつ
- それぞれの`~ns接頭辞$は `互いに一致$する`~ns名$に束縛されている
- この拘束は、どの要素においても,その属性たちの`展開~名$は互いに同じにならないことを要求するのと等価である。 ◎ This constraint is equivalent to requiring that no element have two attributes with the same expanded name.
例えば,次における空~要素~tag `bad^l は、いずれも違法になる: ◎ For example, each of the bad empty-element tags is illegal in the following:
<!--
n1 と n2 はいずれも http://www.w3.org に束縛される
◎
http://www.w3.org is bound to n1 and n2
-->
<x xmlns:n1="http://www.w3.org"
xmlns:n2="http://www.w3.org" >
<bad a="1" a="2" />
<bad n1:a="1" n2:a="2" />
</x>
しかしながら、次のものはいずれも合法になる。 2 番目のものは、属性~名には既定の~nsは適用されないので、合法になる: ◎ However, each of the following is legal, the second because the default namespace does not apply to attribute names:
<!--
n1 は既定の~ns http://www.w3.org に束縛される
◎
http://www.w3.org is bound to n1 and is the default
-->
<x xmlns:n1="http://www.w3.org"
xmlns="http://www.w3.org" >
<good a="1" b="2" />
<good a="1" n1:a="2" />
</x>
7. 文書の適合性
この仕様は ~XML1011 文書に適用される。 この仕様に適合するためには、文書は ~XML1011 仕様 `XML$r`XML11$r に則って整形式で~MUST。 ◎ This specification applies to ~XML1011 documents. To conform to this specification, a document MUST be well-formed according to the ~XML1011 specification [~XML1011].
この仕様に適合する~XML文書においては、要素~名/属性~名は `QName$P 生成規則に合致し, かつ “~ns拘束” を満たさ~MUST。 ~XML1011 整形式であるために~XML生成規則 `~Name10$P `~Name11$P に合致することが要求されている,文書~内の他の(要素~名/属性~名~以外の)すべての~tokenは、この仕様の生成規則 `NCName$P に合致し~MUST。 ◎ In XML documents which conform to this specification, element and attribute names MUST match the production for QName and MUST satisfy the "Namespace Constraints". ◎ All other tokens in the document which are REQUIRED, for ~XML1011 well-formedness, to match the XML production for Name MUST match this specification's production for NCName.
定義: この仕様に適合する文書は、 `~ns整形式@ であるとされる。 ◎ [Definition: A document is namespace-well-formed if it conforms to this specification. ]
よって,`~ns整形式$である文書においては: ◎ It follows that in a namespace-well-formed document:
- [ 要素~名 / 属性~名 ]は 0 個または 1 個の~colon( `:^l )を包含する。 ◎ All element and attribute names contain either zero or one colon;
- [ 実体~名 / 処理命令~target / 記法~名 ]は~colonを包含しない。 ◎ No entity names, processing instruction targets, or notation names contain any colons.
加えて、`~ns整形式$なる文書は,`~nsにおいて妥当$になり得る。 ◎ In addition, a namespace-well-formed document may also be namespace-valid.
定義: `~ns整形式$である文書は、次をいずれも満たすならば `~nsにおいて妥当@ であるとされる:
- ~XML1011 に則って妥当である。 ~XML1011 に則って整形式になるためには、文書~内の[ 要素/属性 ]の名前は,~XML生成規則 `~Name10$P `~Name11$P に合致することが要求される。
- 文書~内の~tokenのうち,[ 要素/属性 ]の名前を除くすべては、この仕様の生成規則 `NCName$P に合致している。
よって、`~nsにおいて妥当$な文書においては、次の型として宣言されている属性は,~colonを包含しない:
- `ID^T
- `IDREF^T
- `IDREFS^T
- `ENTITY^T
- `ENTITIES^T
- `NOTATION^T
8. 処理器の適合性
この仕様に適合するためには、処理器は`~ns整形式$に対する違反を報告し~MUST。 ただし,~ns名が ~URI参照 `RFC3986$r 合法な~IRI であるかどうかの検査は要求されない。 To conform to this specification, a processor MUST report violations of namespace well-formedness, with the exception that it is not REQUIRED to check that namespace names are URI references [RFC3986]legal IRIs.
定義: この仕様に適合する~XML検証用の処理器のうち,~ns妥当性に対する違反を報告するものを `~ns検証用の処理器@ という。 ◎ [Definition: A validating XML processor that conforms to this specification is namespace-validating if in addition it reports violations of namespace validity. ]
付録
この節の各 下位節は規範的でない。
~XML~nsの内部~構造
この付録は削除された。 ◎ This appendix has been deleted.
~version 1.0 からの変更点
この~versionには 2009 年 6 月 20 日付の正誤表 `1.0-Errata$r `1.0-2e-Errata$r が組入れられている。 ◎ This version incorporates the errata as of 20 July 2009 [1.0 Errata] [1.0 2e Errata].
この~versionには,~version 1.0 に対する 2002 年 12 月 6 日付の正誤表 `1.0-Errata$r が組入れられている。 加えて, 2 つの大きな変更点がある: ◎ This version incorporates the errata to version 1.0 as of 6 December 2002 [1.0 Errata]. There are two further substantive changes:
- 接頭辞の未宣言にするための仕組みを供した。 ◎ A mechanism is provided for undeclaring prefixes;
- ~ns名は~URIではなく,~IRIにした。 ◎ Namespace names are IRIs, rather than URIs.
より一貫性を得るため,いくつかの語法の変更や追加を含む編集上の変更点がある。 参考の付録 “~XML~nsの内部~構造” は削除された。 ◎ There are several editorial changes, including a number of terminology changes and additions intended to produce greater consistency. The non-normative appendix "The Internal Structure of XML Namespaces" has been removed.\
第 5 版を含む ~XML 1.0 のすべての版と~~整合するよう, BNF を調整した。 ◎ The BNF has been adjusted to interconnect properly with all editions of XML 1.0, including the fifth edition.
~version 1.1 からの変更点
この~versionには~version 1.1 に対する正誤表 2006 年 6 月 1 日付 `1.1-Errata$r が組入れられている。 ◎ This version incorporates the errata to version 1.1 as of 1 June 2006 [1.1 Errata].
~version 1.1 の初版には、自前の~IRIの定義が含められていた — まだ ~IRI RFC の最終~versionが発行されてなかったので。 これは除去され, RFC への参照に置換された。 ◎ Because the final version of the IRI RFC had not yet been published, the first edition of version 1.1 included its own definition of IRIs. This has been removed, and replaced with a reference to the RFC.
謝辞
この仕事には、多数の方々からの協力が反映されている。 とりわけ、 World Wide Web Consortium XML Working Group, Special Interest Group, W3C Metadata Activity の参加者たち、 Microsoft の Charles Frankston 氏からの特筆に~~値する貢献に感謝する。 ◎ This work reflects input from a very large number of people, including especially the participants in the World Wide Web Consortium XML Working Group and Special Interest Group and the participants in the W3C Metadata Activity. The contributions of Charles Frankston of Microsoft were particularly valuable.
廃止された生成規則
次の 2 つの生成規則は、この仕様の最初と次の版に在ったものの改変版である。 もはや,それらが利用されることはないが、この仕様の日付の無い~versionへの相互参照~用に残されている。 【この訳では~version 1.0, 1.1 の重畳により生じた重複 id を変更しているため(変更はこの節のみ),この相互参照は機能しない。】 ◎ The following two productions are modified versions of ones which were present in the first two editions of this specification. They are no longer used, but are retained here to satisfy cross-references to undated versions of this specification.
`NCNameStartChar^P の定義に元々利用されていた~XML 1.0 の `Letter^P 生成規則は、~XML 1.0 第 5 版からは名前の定義として正しいものではなくなったので、 `NCNameStartChar^P 生成規則は,~XMLのどの版に対しても正しい結果が得られるようにするため, `NCName$P に基づく定義に変更された。 ◎ Because the Letter production of XML 1.0, originally used in the definition of NCNameStartChar, is no longer the correct basis for defining names since XML 1.0 Fifth Edition, the NCNameStartChar production has been modified to give the correct results against any edition of XML, by defining NCNameStartChar in terms of NCName.
- [5] `~NCNameChar10@P
- `NameChar$P - ':'
- ( `:^l 以外の~XML `NameChar$P ) ◎ /* An XML NameChar, minus the ":" */
- [6] `~NCNameStartChar10@P
- `NCName$P - ( `Char$P `Char$P `Char$P* )
- ( `NCName$P の最初の字) ◎ /* The first letter of an NCName */
Note: Production `~NCNameStartChar10$P takes advantage of the fact that a single-character `NCName$P is necessarily an `~NCNameStartChar10$P, and works by subtracting from the set of `NCName$Ps of all lengths the set of all strings of two or more characters, leaving only the NCNames which are one character long.