blob: 350dee9032bca0f0c4a784ecc277dbf3d7b43e08 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. Contributors: IBM Corporation - initial API and implementation" />
<meta name="DC.rights.owner" content="(C) Copyright 2000, 2008" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="task" name="DC.Type" />
<meta name="DC.Title" content="Adding complex types" />
<meta name="abstract" content="A complex type allows elements in its content and can carry attributes. Complex types can be used to help determine the appropriate content for any instance documents generated from or associated with your XML schema." />
<meta name="description" content="A complex type allows elements in its content and can carry attributes. Complex types can be used to help determine the appropriate content for any instance documents generated from or associated with your XML schema." />
<meta content="XML schema editor, complex types, XML schema files" name="DC.subject" />
<meta content="XML schema editor, complex types, XML schema files" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="../topics/taddcmod.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="taddcmxt" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
<title>Adding complex types</title>
</head>
<body id="taddcmxt"><a name="taddcmxt"><!-- --></a>
<h1 class="topictitle1">Adding complex types</h1>
<div><p>A complex type allows elements in its content and can carry attributes.
Complex types can be used to help determine the appropriate content for any
instance documents generated from or associated with your XML schema.</p>
<div class="section"><p>You can add as many complex types as you want to an XML schema.</p>
<p>The
following instructions were written for the Resource perspective, but they
will also work in many other perspectives.</p>
<p>To add a complex type to
an XML schema, complete the following steps:</p>
</div>
<ol>
<li class="stepexpand"><span>Open your XML schema in the XML schema editor.</span></li>
<li class="stepexpand"><span>Right-click the Types category in the Design view, and click <span class="uicontrol">Add
Complex Type</span>.</span></li>
<li class="stepexpand"><span>In the Properties view, type a new name for the complex type in
the <span class="uicontrol">Name</span> field.</span></li>
<li class="stepexpand"><span>Select <span class="uicontrol">Browse</span> in the <span class="uicontrol">Inherited
From</span> drop down to select a base type for your complex type.</span>
You can either set a base type for your complex type, or you can add
a content model to it (which represents any data that can be contained inside
an element), but you cannot do both. For more information about content models,
see <a href="taddcmod.html">Adding content models</a>.
</li>
<li class="stepexpand"><span>Select <span class="uicontrol">restriction</span> or <span class="uicontrol">extension</span> from
the <span class="uicontrol">Inherited By</span> list.</span> This specifies whether
your type is derived from its base type by restriction or extension.
</li>
<li class="stepexpand"><span>The Design view will display the attributes within the complex
type.</span> You can also use this view to add attributes to your complex
type. An attribute associates an attribute name with a specific type and value.
To add an attribute, in the Design view, right click your complex type and
select <span class="uicontrol">Add Attribute</span>.<ul>
<li><span class="uicontrol">name</span>. In the Design view, click the name of the
attribute to make a change.</li>
<li><span class="uicontrol">type</span>. In the Design view, click the type of the
attribute to make a change. The drop-down menu provides commonly used types.
For more options, simply select <span class="uicontrol">Browse</span> from the menu.</li>
</ul>
For information about adding attributes, attribute references, and <kbd class="userinput">any</kbd> attributes,
see <a href="taddagrp.html">Adding attribute groups</a>.
</li>
<li class="stepexpand"><span>Click the <span class="uicontrol">Documentation</span> tab if you want
to provide any information about this complex type.</span> The <span class="uicontrol">Documentation</span> page
is used for human readable material, such as a description.</li>
<li class="stepexpand"><span>Click the <span class="uicontrol">Extensions</span> tab if you want to
add application information elements to your annotations of schema components.</span>
The <span class="uicontrol">Extensions</span> page allows you to specify the
schema and add XML content to your annotations.</li>
</ol>
</div>
<div><div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="../topics/taddcmod.html" title="A content model is the representation of any data that can be contained inside an element, global element, complex type, or group. It is a formal description of the structure and permissible content of an element, global element, complex type, or group, which may be used to validate a document instance.">Adding content models</a></div>
</div>
</div>
</body>
</html>