In Xml schema I can choose the following in respect to a namespace:
在Xml模式中,我可以选择以下名称空间:
- Force Elements to be qualified
- 强制元素必须合格
- Force Attributes to be qualified
- 强制属性要限定
- Force both Elements and Attributes to be qualified.
- 强制元素和属性都要限定。
What is the best option and why?
什么是最好的选择,为什么?
1 个解决方案
#1
6
Qualified element form and unqualified attribute form is de-facto almost standard, this is what I'd recommend.
合格的元素形式和不合格的属性形式实际上几乎是标准的,这是我推荐的。
The rationale is:
基本原理是:
- Elements must be qualified to make use of namespaces as scoping mechanisms.
- 必须对元素进行限定,才能将名称空间用作确定范围的机制。
- Attributes already belong to a certain element so it's easy to assume per default that they also belong to the same scope. Therefore explicit namespace declaration is in most cases not necessary.
- 属性已经属于某个元素,因此可以很容易地假设它们也属于相同的范围。因此,显式名称空间声明在大多数情况下是不必要的。
- You have a different situation when you mix elements and attributes from one schema with attributes from another schema. In this case the mix-in schemas (carrying attributes) must be especially designed (like XLink schema).
- 当您将来自一个模式的元素和属性与来自另一个模式的属性混合在一起时,您将遇到不同的情况。在这种情况下,混合模式(包含属性)必须特别设计(如XLink模式)。
#1
6
Qualified element form and unqualified attribute form is de-facto almost standard, this is what I'd recommend.
合格的元素形式和不合格的属性形式实际上几乎是标准的,这是我推荐的。
The rationale is:
基本原理是:
- Elements must be qualified to make use of namespaces as scoping mechanisms.
- 必须对元素进行限定,才能将名称空间用作确定范围的机制。
- Attributes already belong to a certain element so it's easy to assume per default that they also belong to the same scope. Therefore explicit namespace declaration is in most cases not necessary.
- 属性已经属于某个元素,因此可以很容易地假设它们也属于相同的范围。因此,显式名称空间声明在大多数情况下是不必要的。
- You have a different situation when you mix elements and attributes from one schema with attributes from another schema. In this case the mix-in schemas (carrying attributes) must be especially designed (like XLink schema).
- 当您将来自一个模式的元素和属性与来自另一个模式的属性混合在一起时,您将遇到不同的情况。在这种情况下,混合模式(包含属性)必须特别设计(如XLink模式)。