An attribute group definition is an association between
a name and a set of attribute declarations. Named groups of attribute
declarations can greatly facilitate the maintenance and reuse of common
attribute declarations in an XML schema.
The following instructions were written for the Resource
perspective, but they will also work in many other perspectives.
To
add an attribute group to an XML schema, complete the following steps:
- Open your XML schema in the XML schema editor.
- In the Outline view, right-click the Attributes folder
and click Add Attribute Group. It
appears in the Attributes folder.
- Select your new group, and in the Design view, right-click
the attribute group and select . In the New
Name field, type a name for the attribute group and click OK.
- To add an attribute, right-click your attribute group in
the Outline view, click Add Attribute.
The attribute appears below the attribute group in the Outline
view.
- Select the attribute, and in the Design view, click
the current (default) name of the attribute, then type the new Name.
- In the Design view, click the current (default) attribute
type and select a type from the menu. Alternately, you can select
browse to invoke the Set Type menu for more options. The
Set Type dialog lists all built-in and user-defined types currently
available. You can change the Scope of the
list by selecting one of the following options:
- Workspace. Lists all of the types available
in your workspace.
- Enclosing Project. Lists all of the types
available in the project that contains your file.
- Current Resource (default). List all of
the types available in your current file.
- Working Sets. List all the types available
within the selected working set.
- An attribute reference provides a reference to a global
attribute. To add an attribute reference, in the Design view, right-click
the complex type containing the element, and click Add
Attribute Ref. A declaration that references
a global attribute enables the referenced attribute to appear in the
instance document in the context of the referencing declaration. Select
the reference, then in the Properties view, select the attribute you
want it to reference from the Reference list.
- An attribute group reference provides a reference to an
attribute group. To add an attribute group reference, in the Design
view, right-click the complex type containing the element, and click Add
Attribute Group Ref. A declaration that references
a global attribute enables the referenced attribute to appear in the
instance document in the context of the referencing declaration. Select
the reference, then in the Properties view, select the attribute group
you want it to reference from the Reference list.
- An any element enables element content
according to namespaces, and the corresponding any attribute
element enables attributes to appear in elements. To add an any attribute,
right-click your attribute group and click Add Any Attribute.
The any appears below the attribute group in
the Outline view. You can specify the following values for an any attribute:
- For a Namespace value, you can select:
- ##any: this allows any well-formed XML from any namespace.
- ##local : this allows any well-formed XML that is not declared
to be in a namespace.
- ##other: this allows any well-formed XML that is not from
the target namespace of the type being defined.
- ##targetNamespace : this is shorthand for the target namespace
of the type being defined.
- For a Process Contents value, you can
select:
- skip: the XML processor will not validate the attribute
content at all.
- lax: the XML processor will validate the attribute content
as much as it can.
- strict: the XML processor will validate all the attribute
content.