In the Attributes tab of the Attributes/Assertions/Identity Constraints (AAIDC) pane (screenshot below), you can:
|Note:||If you have chosen the option to display attributes in the diagram (Schema Design | Configure View) rather than in the AAIDC pane, you can edit the properties of attributes, attribute group references, and attribute wildcards in the diagram and Details entry helper.|
Display Attributes in Diagram: Enabled in Content Model View. Toggles the display of attributes between the diagram (toggled on) and the Attributes tab.
In the Attributes tab of the Attributes/Assertions/Identity Constraints (AAIDC) pane (screenshot below), you can declare local attributes of elements and complex types, and the attributes that constitute attribute groups.
To create attributes, do the following:
|1.||In Schema Overview, select the complex type or attribute group for which you wish to create the attribute.|
|2.||In the Attributes tab, click the Append or Insert icon at top left and select Attribute.|
|3.||In the row that is created for the attribute, enter the attribute's details (name, type, use, and default or fixed value). The name property is mandatory, and the default value of use is optional. The datatype and default/fixed value properties are optional.|
|Note:||Attributes can be added to attribute groups only in Schema Overview, but to complex types in both Schema Overview and Content Model View.|
Default values and fixed values
A default value or fixed value, if specified in an attribute declaration, is applied in the instance document when that attribute is absent in the instance document. Either a default value or a fixed value can be specified, not both (see screenshot above). The default or fixed value must be valid according to the attribute's datatype. If use is set to required, then neither default nor fixed value is allowed.
Note the following:
•Default values: A default value is inserted only if the attribute is missing. If the attribute is present and has a valid value, the default value is not inserted. If the value in the instance documents is invalid, an error is raised.
•Fixed values: A fixed value is applied not only when the attribute is missing but also if the value in the instance document is not equal to the fixed value specified in the attribute's declaration.
|Note:||Default and fixed values can be specified on both local and global attributes. On local attributes they can be defined in both the Attributes tab of the AAIDC pane (screenshot above) and in the Details entry helper. On global attributes, they can be specified in the Details entry helper.|
If a global attribute group has been declared, you can add a reference to this attribute group in the definition of a complex type. Do this by selecting the complex type component in Schema Overview or Content Model View, then clicking the Append or Insert icon at top left of the Attributes tab of the AAIDC pane and selecting Attribute Group. In the attribute group row that is created, enter the name of the attribute group to be referenced (see screenshot below, which has two attribute group references). You can add multiple attribute groups.
When the attribute group is selected in the Attributes tab, its properties can also be edited in the Details entry helper.
An attribute wildcard can be added to a complex type to allow the use of any attribute on an element. An attribute wildcard is defined with a single anyAttribute element. It would allow any number of attributes from the specified namespace to occur on the element in the instance document.
Add an attribute wildcard by selecting the complex type component in Schema Overview or Content Model View, then clicking the Append or Insert icon at top left of the Attributes tab of the AAIDC pane and selecting Any Attribute. A row for the attribute wildcard anyAttribute is created (see screenshot below).
In the Attributes tab, you can set the namespace property of anyAttribute. With the attribute wildcard selected in the Attributes tab, you can set additional properties in the Details entry helper (see screenshot above). Note that the notNamespace and notQName properties are XSD 1.1 features and so will not be available in XSD 1.0 mode.
Sorting attributes and attribute groups
You can sort the attributes and attribute groups in the Attributes tab by clicking the Sort icon in the tab's toolbar. In the Sort Components dialog that pops up (screenshot below), you can choose to sort either the selected single component and its siblings or the set of selected components. You can use Shift+click to select a range and Ctrl+click to add additional components to the selection.
After setting the range you can choose to sort the entire range of attributes and attribute groups alphabetically (Name before kind), or attributes sorted alphabetically before attribute groups sorted alphabetically.
The sort order is immediately implemented in the text of the schema document; it is not just an interface mask.
|Note:||Attribute wildcards will not be included in the range to sort since they must always occur at the end of a complex type declaration and only one attribute wildcard is allowed in a single complex type declaration.|