XML Schema attributeGroup 요소

정의와 사용법

attributeGroup 요소는 속성 선언을 조합하여 이러한 선언이 복잡한 유형으로 조합된 형태로 병합될 수 있도록 사용됩니다.

요소 정보

출현 횟수 제한 없음
부요소 attributeGroup, complexType, schema, restriction (simpleContent), extension (simpleContent), restriction (complexContent), extension (complexContent)
내용 annotation, attribute, attributeGroup, anyAttribute

문법

<attributeGroup
id=ID
name=NCName
ref=QName
모든 속성
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>

(? 기호는 attributeGroup 요소에서 선언되며, 요소는 0번 또는 1번만 나타날 수 있습니다. * 기호는 요소가 0번 또는 여러 번 나타날 수 있습니다.)

속성 설명
id 선택 사항입니다. 이 요소의 독특한 ID를 정의합니다.
name 선택 사항입니다. 속성 그룹의 이름을 정의합니다. name과 ref 속성은 동시에 사용할 수 없습니다.
ref 선택 사항입니다. 지정된 속성 그룹에 대한 참조를 정의합니다. name과 ref 속성은 동시에 사용할 수 없습니다.
모든 속성 선택 사항입니다. non-schema 명명 공간을 가진 다른 어떤 속성도 정의합니다.

예제

<xs:attributeGroup name="personattr">
  <xs:attribute name="attr1" type="string"/>
  <xs:attribute name="attr2" type="integer"/>
</xs:attributeGroup>
<xs:complexType name="person">
  <xs:attributeGroup ref="personattr"/>
</xs:complexType>

위의 예제는 "personattr"라는 속성 그룹을 정의하며, "person"이라는 복잡 타입에서 사용됩니다.