Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

<xsd:attributeGroup> Element

Groups a set of attribute declarations so that they can be incorporated as a group for complex type definitions.

<attributeGroup
  id = ID 
  name = NCName
  ref = QName
  {any attributes with non-schema Namespace...}>
Content: (annotation?), ((attribute | attributeGroup)*, anyAttribute?))
</attributeGroup>
id
The ID of this element. The id value must be of type ID and be unique within the document containing this element.

Optional.

name
The name of the attribute group whose attributes are included in an attributeGroup element or complexType element. The name must be a no-colon-name (NCName) as defined in the XML Namespaces specification. Name and ref attributes cannot both be present. Name attribute can only be present if the attribute group is a child of the schema element.

Optional.

ref
The reference name of the attribute group whose attributes are included in an attributeGroup element or complexType element.

Name and ref attributes cannot both be present. Ref attribute can only be present if the attribute group is not a child of the schema element.

This value must be a qualified name (QName).

Optional.

An attribute group can be defined only as a child of the schema element. In this case, the name attribute must be present and contain the attribute, attributeGroup, or anyAttribute elements that make up the attribute group.

An attribute group can be included in an attributeGroup or complexType, in which case, the ref attribute must be present and the attributeGroup element must be empty. See the following example.

The attributeGroup elements can contain other attributeGroup elements.

The following example shows an attribute group defined (myAttributeGroup) and used in a complex type (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>

The following example shows two attribute groups defined (myAttributeGroupA and myAttributeGroupB) with one containing the other.

<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>

For more information see the W3C XML Schema Part 1: Structures Recommendation at www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-all.




Build Date:

2012-08-02
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.