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" 이름의 복잡 타입에서 사용합니다.