An Attribute Group maps to a simple UML Class with the stereotype XSDattributeGroup.

  • name – to UML Class name
  • annotation – to UML Class documentation
  • attribute – to inner UML Attribute or AssociationEnd with XSDattribute
  • stereotype.
  • attributeGroup - the inner attributeGroup must only be reference. This reference maps to Attribute or AssociationEnd with the type of referenced attributeGroup. The opposite Association End kind must be aggregated and it must be navigable.
  • anyAttribute – to inner UML Attribute with stereotype XSDanyAttribute.

If the reference is generated, a name is not generated.

When an <attributeGroup> appears as a daughter of  <schema> or <redefine>, it corresponds to an attribute group definition, shown below. When it appears as a daughter of <complexType>  or <attributeGroup>, it does not correspond to any component  as such.

attributeGroup UML model example.


attributeGroup UML model example with associated XML
<xs:schema xmlns:nm = "http://nomagic.com" xmlns:xs = "http://www.w3.org/2001/XMLSchema" targetNamespace = "http://nomagic.com"
	<xs:attributeGroup name = "global_attr_group">
		<xs:attribute name = "address" type = "xs:string" />
</xs:attributeGroup>
	<xs:attributeGroup name = "attr_group_name" >
		<xs:annotation>
			<xs:documentation>attribute group documentation</xs:documentation>
</xs:annotation>
		<xs:attribute name = "surname" type = "xs:string"/>
		<xs:attribute name = "name" type = "xs:string" >
			<xs:annotation >
				<xs:documentation >name attribute documentation</xs:documentation>
			</xs:annotation>
</xs:attribute>
		<xs:attributeGroup ref = "nm:global_attr_group2" >
			<xs:annotation >
				<xs:documentation >reference documentation</xs:documentation>
			</xs:annotation>
</xs:attributeGroup>
<xs:anyAttribute />
	</xs:attributeGroup>
	<xs:attributeGroup name = "global_attr_group2" >
<xs:attribute name = "city" type = "xs:string"/>
</xs:attributeGroup>
</xs:schema>