<all> 之间的区别<序列><选择>和<组>在 XSD 中? [英] The difference between <all> <sequence> <choice> and <group> in XSD?
本文介绍了<all> 之间的区别<序列><选择>和<组>在 XSD 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<all>有什么区别?<序列><选择>和 XML Schema 中的 <group>
?
推荐答案
什么时候使用 xsd:all
, xsd:sequence
, xsd:choice代码>,或
xsd:group
:
When to use xsd:all
, xsd:sequence
, xsd:choice
, or xsd:group
:
- 当所有子元素必须存在时使用
xsd:all
,独立于订购. - 当子元素必须存在时,使用
xsd:sequence
出现限制和顺序很重要. - 当其中一个子元素必须存在时,使用
xsd:choice
. - 使用
xsd:group
作为包装上述任何内容的一种方式,以便命名并在 XSD 内的多个位置重复使用.
- Use
xsd:all
when all child elements must be present, independent of order. - Use
xsd:sequence
when child elements must be present per their occurrence constraints and order does matters. - Use
xsd:choice
when one of the child element must be present. - Use
xsd:group
as a way to wrap any of the above in order to name and reuse in multiple locations within an XSD.
请注意,除了子元素之外,出现约束还可以出现在 xsd:all
、xsd:sequence
或 xsd:choice
上实现各种基数效果.
Note that occurrence constraints can appear on xsd:all
, xsd:sequence
, or xsd:choice
in addition to the child elements to achieve various cardinality effects.
这篇关于<all> 之间的区别<序列><选择>和<组>在 XSD 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文