blob: e50e6bf822f336ab85b43b75945fd6870b940098 [file] [log] [blame]
kprice159fa582006-05-08 21:30:45 +00001<?xml version="1.0" encoding="utf-8"?>
kpricede20a692008-04-24 00:27:47 +00002<!--Arbortext, Inc., 1988-2006, v.4002-->
kprice647b7352006-05-17 21:27:16 +00003<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN"
4 "task.dtd">
5<?Pub Inc?>
kprice159fa582006-05-08 21:30:45 +00006<task id="taddcmxt" xml:lang="en-us">
7<title>Adding complex types</title>
9<searchtitle>Adding complex types</searchtitle>
11<shortdesc>A complex type allows elements in its content and can carry attributes.
12Complex types can be used to help determine the appropriate content for any
13instance documents generated from or associated with your XML schema.</shortdesc>
kprice9623e9d2007-05-03 03:43:05 +000015<keywords><indexterm>XML schema editor<indexterm>complex types</indexterm></indexterm>
16<indexterm>XML schema files<indexterm>complex types</indexterm></indexterm>
kprice159fa582006-05-08 21:30:45 +000017</keywords>
20<context><p>You can add as many complex types as you want to an XML schema.</p><p>The
21following instructions were written for the Resource perspective, but they
22will also work in many other perspectives.</p><p>To add a complex type to
kpricede20a692008-04-24 00:27:47 +000023an XML schema, complete the following steps:</p></context>
kprice159fa582006-05-08 21:30:45 +000024<steps>
25<step><cmd>Open your XML schema in the XML schema editor.</cmd></step>
kprice647b7352006-05-17 21:27:16 +000026<step><cmd>Right-click the Types category in the Design view, and click <uicontrol>Add
kprice159fa582006-05-08 21:30:45 +000027Complex Type</uicontrol>.</cmd></step>
28<step><cmd>In the Properties view, type a new name for the complex type in
29the <uicontrol>Name</uicontrol> field.</cmd></step>
kpricede20a692008-04-24 00:27:47 +000030<step><cmd>Select <uicontrol>Browse</uicontrol> in the <uicontrol>Inherited
31From</uicontrol> drop down to select a base type for your complex type.</cmd>
kprice647b7352006-05-17 21:27:16 +000032<info>You can either set a base type for your complex type, or you can add
33a content model to it (which represents any data that can be contained inside
34an element), but you cannot do both. For more information about content models,
kpricede20a692008-04-24 00:27:47 +000035see <xref href="taddcmod.dita" scope="peer">Adding content models</xref>.</info>
kprice159fa582006-05-08 21:30:45 +000037<step><cmd>Select <uicontrol>restriction</uicontrol> or <uicontrol>extension</uicontrol> from
kpricede20a692008-04-24 00:27:47 +000038the <uicontrol>Inherited By</uicontrol> list.</cmd><info>This specifies whether
kprice159fa582006-05-08 21:30:45 +000039your type is derived from its base type by restriction or extension.</info>
kprice647b7352006-05-17 21:27:16 +000041<step><cmd>The Design view will display the attributes within the complex
42type.</cmd><info>You can also use this view to add attributes to your complex
kpricede20a692008-04-24 00:27:47 +000043type. An attribute associates an attribute name with a specific type and value.
44To add an attribute, in the Design view, right click your complex type and
45select <uicontrol>Add Attribute</uicontrol>.<ul>
kprice647b7352006-05-17 21:27:16 +000046<li><uicontrol>name</uicontrol>. In the Design view, click the name of the
47attribute to make a change.</li>
48<li><uicontrol>type</uicontrol>. In the Design view, click the type of the
49attribute to make a change. The drop-down menu provides commonly used types.
50For more options, simply select <uicontrol>Browse</uicontrol> from the menu.</li>
kpricede20a692008-04-24 00:27:47 +000051</ul>For information about adding attributes, attribute references, and <userinput>any</userinput> attributes<?Pub Caret?>,
52see <xref href="taddagrp.dita" scope="peer">Adding attribute groups</xref>.</info>
kprice159fa582006-05-08 21:30:45 +000053</step>
kprice159fa582006-05-08 21:30:45 +000054<step><cmd>Click the <uicontrol>Documentation</uicontrol> tab if you want
55to provide any information about this complex type.</cmd><info>The <uicontrol>Documentation</uicontrol> page
kprice647b7352006-05-17 21:27:16 +000056is used for human readable material, such as a description.</info></step>
57<step><cmd>Click the <uicontrol>Extensions</uicontrol> tab if you want to
58add application information elements to your annotations of schema components.</cmd>
59<info>The <uicontrol>Extensions</uicontrol> page allows you to specify the
60schema and add XML content to your annotations.</info></step>
kprice159fa582006-05-08 21:30:45 +000061</steps>
kpricede20a692008-04-24 00:27:47 +000064<?Pub *0000003647?>