![]() |
| Previous Top Next |
Specifying the Type of an Element |
The child elements of Address displayed in Grid View are those defined for the global complex type AddressType (content model of which is shown in screenshot below).

We would, however, like to use a specific US or UK address type rather than the generic address type. You will recall that, in the AddressLast.xsd schema, we created global complex types for US-Address and UK-Address by extending the AddressType complex type. The content model of US-Address is shown below.

In the XML document, in order to specify that the Address element must conform to one of the extended Address types (US-Address or UK-Address) rather than the generic AddressType, we must specify the required extended complex type as an attribute of the Address element.
Do the following:
| 1. | Right-click the Name element, and select Insert | Attribute from the context menu. |

An attribute field is added to the Address element.
| 2. | Ensure that xsi:type is entered as the name of the attribute (screenshot below). |
| 3. | Press Tab to move into the next (value) field. |

| 4. | Enter US-Address as the value of the attribute. |
Please note: The xsi prefix allows you to use special XML Schema related commands in your XML document instance. In the above case, you have specified a type for the Address element. See the XML Schema specification for more information.
|