XML Schema group element

Definition and usage

The group element is used to define a group of elements used in complex type definitions.

element information

occurrence count unrestricted
parent element schema、choice、sequence、complexType、restriction (complexContent)、extension (complexContent)
content annotation、all、choice、sequence

grammar

<group
id=ID
name=NCName
ref=QName
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
কোনও অতিরিক্ত অবকল্প
>
annotation?,(all|choice|sequence)?)

(? 符号声明在 group 元素中,该元素可出现零次或一次。)

属性

id

可选。规定该元素的唯一的 ID。

name

可选。规定组的名称。该名称必须是在 XML 命名空间规范中定义的无冒号名称 (NCName)。

仅当 schema 元素是该 group 元素的父元素时才使用该属性。在此情况下,group 是由 complexType、choice 和 sequence 元素使用的模型组。

name 属性和 ref 属性不能同时出现。

ref

可选。引用另一个组的名称。ref 值必须是 QName。 ref 可以包含命名空间前缀。

name 属性和 ref 属性不能同时出现。

maxOccurs

可选。规定 group 元素可在父元素中出现的最大次数。该值可以是大于或等于零的整数。若不想对最大次数设置任何限制,请使用字符串 "unbounded"。默认值为 1。

minOccurs

可选。规定 group 元素可在父元素中出现的最小次数。该值可以是大于或等于零的整数。默认值为 1。

কোনও অতিরিক্ত অবকল্প

অপশনাল।নীতিগত নামক সমূহকে নির্দিষ্ট করুন

প্রতিদর্শ

উদাহরণ 1

এই উদাহরণটি একটি চারটি উপাদান ধারাবাহিকতা ধারণকারী গ্রুপটি পরিভাষিত করে এবং এটিকে একটি জটিল ধরনের পরিভাষায় ব্যবহার করে:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:group name="custGroup">
 <xs:sequence>
  <xs:element name="customer" type="xs:string"/>
  <xs:element name="orderdetails" type="xs:string"/>
  <xs:element name="billto" type="xs:string"/>
  <xs:element name="shipto" type="xs:string"/>
 </xs:sequence>
</xs:group>
<xs:element name="order" type="ordertype"/>
<xs:complexType name="ordertype">
  <xs:group ref="custGroup"/>
  <xs:attribute name="status" type="xs:string"/>
</xs:complexType>
</xs:schema>