This documentation is archived and is not being maintained.

Creating Complex XML Types

Visual Studio .NET 2003

Complex types allow you define elements with attributes or subelements in your XML Schema. For example, you could define an addressType made up of name, address, and postal code. This new type could then be used by an Address element.

To create a new complexType object

  1. Add an XML Schema or DataSet to your project. For details, see Adding New Schemas.
  2. Drag a complexType object from the XML Schema tab of the Toolbox onto the design surface.
  3. In the edit box in the grid header, select complexType1 and type a new value to rename the object.
  4. To specify the elements for the complex type, follow these steps:
    1. In the first empty row in the grid, select the small cell next to the asterisk to access the element type drop-down list box.
    2. Choose the type of element from the list.
    3. In the second cell, replace the default name with a name for the element you chose.
    4. In the third cell, select the type for the element. You can choose an existing type, an unnamed type, or a type you have created.
  5. Continue adding elements to the complex type until it is fully declared.

To delete an element from a complexType

  • Right-click the row you want to delete, and then click Delete on the shortcut menu.

To delete an entire complexType

  • Right-click the header of the grid, and then click Delete.

See Also

Creating XML Schemas: High-Level Process | Complex Types in XML Schemas| Walkthrough: Creating an XML Schema with the XML Designer | complexType Element

Show: