xmlns 属性在哪里定义?
Where is xmlns attribute defined?
我知道这是正确的XML
<Data xmlns="http://w3.schools.com">
<One>Data1</One>
</Data>
xmlns
是一个属性,使用上述语法意味着所有节点都属于双引号中的命名空间。我无法理解的是 xmlns
属性定义在哪里?
有关 xmlns
属性和 xmlns:
前缀的定义,请参见 Namespaces in XML 1.0 W3C Recommendation。
使用原因总结xmlns
:
- 使用
xmlns
作为属性定义一个XML命名空间,这是一个
命名标准旨在让各方独立定义
元素和属性名称的词汇表,同时避免命名
碰撞。
- 使用
xmlns:
作为前缀 定义自定义前缀,XML
命名空间值可以被shorthand. 引用
属性xmlns
属性 xmlns
是 reserved attribute and is defined as follows:
DefaultAttName ::= 'xmlns'
前缀xmlns:
前缀 xmlns:
是 reserved prefix and defined as follows:
[2] PrefixedAttName ::= 'xmlns:' NCName
另见 Namespace constraint: Reserved Prefixes and Namespace Names
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/.
It MUST NOT be declared . Other prefixes MUST NOT be bound to this
namespace name, and it MUST NOT be declared as the default namespace.
Element names MUST NOT have the prefix xmlns.
引用自XML Recommendation
2.3 Common Syntactic Constructs
Note:
The Namespaces in XML Recommendation [XML Names] assigns a meaning to
names containing colon characters. Therefore, authors should not use
the colon in XML names except for namespace purposes, but XML
processors must accept the colon as a name character.
我知道这是正确的XML
<Data xmlns="http://w3.schools.com">
<One>Data1</One>
</Data>
xmlns
是一个属性,使用上述语法意味着所有节点都属于双引号中的命名空间。我无法理解的是 xmlns
属性定义在哪里?
有关 xmlns
属性和 xmlns:
前缀的定义,请参见 Namespaces in XML 1.0 W3C Recommendation。
使用原因总结xmlns
:
- 使用
xmlns
作为属性定义一个XML命名空间,这是一个 命名标准旨在让各方独立定义 元素和属性名称的词汇表,同时避免命名 碰撞。 - 使用
xmlns:
作为前缀 定义自定义前缀,XML 命名空间值可以被shorthand. 引用
属性xmlns
属性 xmlns
是 reserved attribute and is defined as follows:
DefaultAttName ::= 'xmlns'
前缀xmlns:
前缀 xmlns:
是 reserved prefix and defined as follows:
[2] PrefixedAttName ::= 'xmlns:' NCName
另见 Namespace constraint: Reserved Prefixes and Namespace Names
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/. It MUST NOT be declared . Other prefixes MUST NOT be bound to this namespace name, and it MUST NOT be declared as the default namespace. Element names MUST NOT have the prefix xmlns.
引用自XML Recommendation
2.3 Common Syntactic Constructs
Note:
The Namespaces in XML Recommendation [XML Names] assigns a meaning to names containing colon characters. Therefore, authors should not use the colon in XML names except for namespace purposes, but XML processors must accept the colon as a name character.