&lt;all&gt; 之间的区别&lt;序列&gt;<选择>和&lt;组&gt;在 XSD 中? [英] The difference between &lt;all&gt; &lt;sequence&gt; &lt;choice&gt; and &lt;group&gt; in XSD?

查看:31
本文介绍了&lt;all&gt; 之间的区别&lt;序列&gt;<选择>和&lt;组&gt;在 XSD 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么区别?<序列><选择>和 在 XML 模式中?

What is the difference between <all> <sequence> <choice> and <group> in XML Schema?

推荐答案

何时使用 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:allxsd:sequencexsd: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.

这篇关于&lt;all&gt; 之间的区别&lt;序列&gt;<选择>和&lt;组&gt;在 XSD 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆