开发者

Xml Schema use qualified or unqualified

开发者 https://www.devze.com 2023-01-26 06:36 出处:网络
In Xml schema I can choose the following in respect to a namespace: Force Elements to be qualified Force Attributes to be qualified

In Xml schema I can choose the following in respect to a namespace:

  • Force Elements to be qualified
  • Force Attributes to be qualified
  • 开发者_如何学GoForce both Elements and Attributes to be qualified.

What is the best option and why?


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).
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号