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).
精彩评论