특성 선언 집합을 그룹화하여 복합 형식 정의에 대한 그룹으로 포함될 수 있도록 합니다.
<attributeGroup
id = ID
name = NCName
ref = QName
{any attributes with non-schema Namespace...}>
Content: (annotation?), ((attribute | attributeGroup)*, anyAttribute?))
</attributeGroup>
특성
id
이 요소의 ID입니다. id 값은 ID 형식이어야 하며 이 요소를 포함하는 문서 내에서 고유한 값이어야 합니다.선택적 항목입니다.
name
해당 특성이 attributeGroup 요소나 complexType 요소에 포함되어 있는 특성 그룹의 이름입니다. 이 이름은 XML 네임스페이스 사양에 정의된 대로 NCName(No-Colon-Name)이어야 합니다. Name 및 ref 특성을 둘 다 지정할 수 없습니다. Name 특성은 특성 그룹이 schema 요소의 자식인 경우에만 지정할 수 있습니다.선택적 항목입니다.
ref
해당 특성이 attributeGroup 요소나 complexType 요소에 포함되어 있는 특성 그룹의 참조 이름입니다.Name 및 ref 특성을 둘 다 지정할 수 없습니다. Ref 특성은 특성 그룹이 schema 요소의 자식이 아닌 경우에만 지정할 수 있습니다.
이 값은 정규화된 이름(QName)이어야 합니다.
선택적 항목입니다.
요소 정보
발생 횟수 |
제한 없음 |
부모 요소 |
attributeGroup, complexType, schema, restriction (simpleContent), extension (simpleContent), restriction (complexContent), extension (complexContent) |
내용 |
annotation, attribute, attributeGroup, anyAttribute |
주의
특성 그룹은 schema 요소의 자식으로만 정의할 수 있습니다. 이 경우 name 특성이 지정되어야 하며 특성 그룹을 구성하는 attribute, attributeGroup 또는 anyAttribute 요소를 포함해야 합니다.
특성 그룹은 attributeGroup 또는 complexType에 포함될 수 있으며 이 경우 ref 특성이 지정되어야 하고 attributeGroup 요소는 비어 있어야 합니다. 다음 예제를 참조하십시오.
attributeGroup 요소에 다른 attributeGroup 요소가 포함될 수도 있습니다.
예제
다음 예제에서는 특성 그룹을 (myAttributeGroup)으로 정의하고 복합 형식 (myElementType)에 사용하는 것을 보여 줍니다.
<xs:attributeGroup name="myAttributeGroup">
<xs:attribute name="someattribute1" type="xs:integer"/>
<xs:attribute name="someattribute2" type="xs:string"/>
</xs:attributeGroup>
<xs:complexType name="myElementType">
<xs:attributeGroup ref="myAttributeGroup"/>
</xs:complexType>
다음 예제에서는 (myAttributeGroupA 및 myAttributeGroupB)를 포함하고 있는 형태로 정의된 두 개의 특성 그룹을 보여 줍니다.
<xs:attributeGroup name="myAttributeGroupA">
<xs:attribute name="someattribute10" type="xs:integer"/>
<xs:attribute name="someattribute11" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="myAttributeGroupB">
<xs:attribute name="someattribute20" type="xs:date"/>
<xs:attributeGroup ref="myAttributeGroupA"/>
</xs:attributeGroup>
관련 자료
자세한 내용은 www.w3.org/TR/2001/REC-xmlschema-1-20010502/\#element-all에 있는 Structures Recommendation을 참조하십시오.